Module Name:    src
Committed By:   matt
Date:           Mon Jul 16 17:39:29 UTC 2012

Modified Files:
        src/gnu/dist/gcc4/gcc/config/vax: builtins.md vax.md

Log Message:
Fix ffssi2 again.
Use a UNSPEC for the internal ffs.
use (match_dup 1) since Z will be set if it is 0 just as if tst:SI was done.
This can let gcc produce better code if you code appropriately.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/gnu/dist/gcc4/gcc/config/vax/builtins.md
cvs rdiff -u -r1.15 -r1.16 src/gnu/dist/gcc4/gcc/config/vax/vax.md

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/gnu/dist/gcc4/gcc/config/vax/builtins.md
diff -u src/gnu/dist/gcc4/gcc/config/vax/builtins.md:1.3 src/gnu/dist/gcc4/gcc/config/vax/builtins.md:1.4
--- src/gnu/dist/gcc4/gcc/config/vax/builtins.md:1.3	Wed Jul 11 13:34:45 2012
+++ src/gnu/dist/gcc4/gcc/config/vax/builtins.md	Mon Jul 16 17:39:29 2012
@@ -25,7 +25,7 @@
   "
 {
   rtx label = gen_label_rtx ();
-  emit_insn (gen_ffssi2_internal (operands[0], operands[1], operands[1]));
+  emit_insn (gen_unspec_ffssi2 (operands[0], operands[1]));
   emit_jump_insn (gen_bne (label));
   emit_insn (gen_negsi2 (operands[0], const1_rtx));
   emit_label (label);
@@ -33,9 +33,15 @@
   DONE;
 }")
 
-(define_insn "ffssi2_internal"
+;;
+;; Set cc0 to match argument 1 since if it is 0, Z will be set just as
+;; if a tst:SI was performed.  If we did a match_dup 0, that wouldn't be
+;; right since 0 will be set to (0+32) [the position (relative to the base)
+;; of a bit one position to the left of the specified field].
+;;
+(define_insn "unspec_ffssi2"
   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
-        (ffs:SI (match_operand:SI 1 "general_operand" "nrQ")))
-   (set (cc0) (ffs:SI (match_operand:SI 2 "general_operand" "1")))]
+        (unspec:SI [(match_operand:SI 1 "general_operand" "nrQ")] VUNSPEC_FFS))
+   (set (cc0) (match_dup 1))]
   ""
   "ffs $0,$32,%1,%0")

Index: src/gnu/dist/gcc4/gcc/config/vax/vax.md
diff -u src/gnu/dist/gcc4/gcc/config/vax/vax.md:1.15 src/gnu/dist/gcc4/gcc/config/vax/vax.md:1.16
--- src/gnu/dist/gcc4/gcc/config/vax/vax.md:1.15	Sun Feb  5 17:34:34 2012
+++ src/gnu/dist/gcc4/gcc/config/vax/vax.md	Mon Jul 16 17:39:29 2012
@@ -34,6 +34,8 @@
   [(VUNSPEC_BLOCKAGE 0)	    ; `blockage' insn to prevent scheduling across an
 			    ; insn in the code.
    (VUNSPEC_SYNC_ISTREAM 1) ; sequence of insns to sync the I-stream
+   (VUNSPEC_FFS 2)          ; internal FFS for the expand
+   (VUNSPEC_FFC 3)          ; internal FFC for the expand
    (VAX_AP_REGNUM 12)	    ; Register 12 contains the argument pointer
    (VAX_FP_REGNUM 13)	    ; Register 13 contains the frame pointer
    (VAX_SP_REGNUM 14)	    ; Register 14 contains the stack pointer

Reply via email to