Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/gnu/dist/gcc4/gcc/config/vax Fix ffssi2 again.



details:   https://anonhg.NetBSD.org/src/rev/c164690f6ac7
branches:  trunk
changeset: 780227:c164690f6ac7
user:      matt <matt%NetBSD.org@localhost>
date:      Mon Jul 16 17:39:29 2012 +0000

description:
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.

diffstat:

 gnu/dist/gcc4/gcc/config/vax/builtins.md |  14 ++++++++++----
 gnu/dist/gcc4/gcc/config/vax/vax.md      |   2 ++
 2 files changed, 12 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r aa66a0b494ef -r c164690f6ac7 gnu/dist/gcc4/gcc/config/vax/builtins.md
--- a/gnu/dist/gcc4/gcc/config/vax/builtins.md  Mon Jul 16 13:55:01 2012 +0000
+++ b/gnu/dist/gcc4/gcc/config/vax/builtins.md  Mon Jul 16 17:39:29 2012 +0000
@@ -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")
diff -r aa66a0b494ef -r c164690f6ac7 gnu/dist/gcc4/gcc/config/vax/vax.md
--- a/gnu/dist/gcc4/gcc/config/vax/vax.md       Mon Jul 16 13:55:01 2012 +0000
+++ b/gnu/dist/gcc4/gcc/config/vax/vax.md       Mon Jul 16 17:39:29 2012 +0000
@@ -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



Home | Main Index | Thread Index | Old Index