OSDN Git Service

(zero_extendhisi2, extendhisi2, extendqihi2,
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 2 Jul 1993 20:36:28 +0000 (20:36 +0000)
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 2 Jul 1993 20:36:28 +0000 (20:36 +0000)
extendqisi2): Preserve the SUBREG_WORD value of subreg operands.
(ashldi3): Delete, obsoleted by lshldi3 pattern.
(lshldi3): Rename to ashldi3 for consistency with SImode shifts.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@4832 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/config/sparc/sparc.md

index d4b1660..3e3d04b 100644 (file)
 {
   rtx temp = gen_reg_rtx (SImode);
   rtx shift_16 = gen_rtx (CONST_INT, VOIDmode, 16);
+  int op1_subword = 0;
 
   if (GET_CODE (operand1) == SUBREG)
-    operand1 = XEXP (operand1, 0);
+    {
+      op1_subword = SUBREG_WORD (operand1);
+      operand1 = XEXP (operand1, 0);
+    }
 
-  emit_insn (gen_ashlsi3 (temp, gen_rtx (SUBREG, SImode, operand1, 0),
+  emit_insn (gen_ashlsi3 (temp, gen_rtx (SUBREG, SImode, operand1,
+                                        op1_subword),
                          shift_16));
   emit_insn (gen_lshrsi3 (operand0, temp, shift_16));
   DONE;
 {
   rtx temp = gen_reg_rtx (SImode);
   rtx shift_16 = gen_rtx (CONST_INT, VOIDmode, 16);
+  int op1_subword = 0;
 
   if (GET_CODE (operand1) == SUBREG)
-    operand1 = XEXP (operand1, 0);
+    {
+      op1_subword = SUBREG_WORD (operand1);
+      operand1 = XEXP (operand1, 0);
+    }
 
-  emit_insn (gen_ashlsi3 (temp, gen_rtx (SUBREG, SImode, operand1, 0),
+  emit_insn (gen_ashlsi3 (temp, gen_rtx (SUBREG, SImode, operand1,
+                                        op1_subword),
                          shift_16));
   emit_insn (gen_ashrsi3 (operand0, temp, shift_16));
   DONE;
 {
   rtx temp = gen_reg_rtx (SImode);
   rtx shift_24 = gen_rtx (CONST_INT, VOIDmode, 24);
+  int op1_subword = 0;
+  int op0_subword = 0;
 
   if (GET_CODE (operand1) == SUBREG)
-    operand1 = XEXP (operand1, 0);
+    {
+      op1_subword = SUBREG_WORD (operand1);
+      operand1 = XEXP (operand1, 0);
+    }
   if (GET_CODE (operand0) == SUBREG)
-    operand0 = XEXP (operand0, 0);
-  emit_insn (gen_ashlsi3 (temp, gen_rtx (SUBREG, SImode, operand1, 0),
+    {
+      op0_subword = SUBREG_WORD (operand0);
+      operand0 = XEXP (operand0, 0);
+    }
+  emit_insn (gen_ashlsi3 (temp, gen_rtx (SUBREG, SImode, operand1,
+                                        op1_subword),
                          shift_24));
   if (GET_MODE (operand0) != SImode)
-    operand0 = gen_rtx (SUBREG, SImode, operand0, 0);
+    operand0 = gen_rtx (SUBREG, SImode, operand0, op0_subword);
   emit_insn (gen_ashrsi3 (operand0, temp, shift_24));
   DONE;
 }")
 {
   rtx temp = gen_reg_rtx (SImode);
   rtx shift_24 = gen_rtx (CONST_INT, VOIDmode, 24);
+  int op1_subword = 0;
 
   if (GET_CODE (operand1) == SUBREG)
-    operand1 = XEXP (operand1, 0);
-  emit_insn (gen_ashlsi3 (temp, gen_rtx (SUBREG, SImode, operand1, 0),
+    {
+      op1_subword = SUBREG_WORD (operand1);
+      operand1 = XEXP (operand1, 0);
+    }
+
+  emit_insn (gen_ashlsi3 (temp, gen_rtx (SUBREG, SImode, operand1,
+                                        op1_subword),
                          shift_24));
   emit_insn (gen_ashrsi3 (operand0, temp, shift_24));
   DONE;
 \f
 ;;- arithmetic shift instructions
 
-;; We can trivially handle shifting the constant 1 by 64 bits.
-;; For other shifts we use the library routine.
-;; ??? Questionable, we can do better than this can't we?
-(define_expand "ashldi3"
-  [(parallel [(set (match_operand:DI 0 "register_operand" "")
-                  (ashift:DI (match_operand:DI 1 "const_double_operand" "")
-                             (match_operand:SI 2 "register_operand" "")))
-             (clobber (reg:SI 0))])]
-  ""
-  "
-{
-  if (GET_CODE (operands[1]) == CONST_DOUBLE
-      && CONST_DOUBLE_HIGH (operands[1]) == 0
-      && CONST_DOUBLE_LOW (operands[1]) == 1)
-    operands[1] = const1_rtx;
-  else if (operands[1] != const1_rtx)
-    FAIL;
-}")
-
-;; ??? Questionable, we can do better than this can't we?
-(define_insn ""
-  [(set (match_operand:DI 0 "register_operand" "=&r")
-       (ashift:DI (const_int 1)
-                  (match_operand:SI 1 "register_operand" "r")))
-   (clobber (reg:SI 0))]
-  ""
-  "subcc %1,32,%%g0\;addx %%g0,0,%R0\;xor %R0,1,%0\;sll %R0,%1,%R0\;sll %0,%1,%0"
-  [(set_attr "type" "multi")
-   (set_attr "length" "5")])
-
 (define_insn "ashlsi3"
   [(set (match_operand:SI 0 "register_operand" "=r")
        (ashift:SI (match_operand:SI 1 "register_operand" "r")
   ""
   "sll %1,%2,%0")
 
-(define_expand "lshldi3"
+(define_expand "ashldi3"
   [(parallel [(set (match_operand:DI 0 "register_operand" "")
-                  (lshift:DI (match_operand:DI 1 "register_operand" "")
+                  (ashift:DI (match_operand:DI 1 "register_operand" "")
                              (match_operand:DI 2 "const_int_operand" "")))
              (clobber (match_scratch:SI 3 ""))])]
   ""
 
 (define_insn ""
   [(set (match_operand:DI 0 "register_operand" "=r")
-       (lshift:DI (match_operand:DI 1 "register_operand" "r")
+       (ashift:DI (match_operand:DI 1 "register_operand" "r")
                     (match_operand:DI 2 "const_int_operand" "I")))
    (clobber (match_scratch:SI 3 "=r"))]
   "INTVAL (operands[2]) < 32"