]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm.md (thumb1_addsi3): Add alternative and split for computing the sum of the stack...
authorBernd Schmidt <bernds@codesourcery.com>
Tue, 20 Jul 2010 20:50:44 +0000 (20:50 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Tue, 20 Jul 2010 20:50:44 +0000 (20:50 +0000)
* config/arm/arm.md (thumb1_addsi3): Add alternative and split for
computing the sum of the stack pointer and a large constant.
* config/arm/constraints.md (M): Remove superfluous parentheses.
(Pc): New constraint.

From-SVN: r162355

gcc/ChangeLog
gcc/config/arm/arm.md
gcc/config/arm/constraints.md

index 95914c7ca68dc8b6d5a198247fff6ed49c2c46b9..b2beeea43605bcbf260da298772e137bfec28655 100644 (file)
@@ -1,3 +1,10 @@
+2010-07-20  Bernd Schmidt  <bernds@codesourcery.com>
+
+       * config/arm/arm.md (thumb1_addsi3): Add alternative and split for
+       computing the sum of the stack pointer and a large constant.
+       * config/arm/constraints.md (M): Remove superfluous parentheses.
+       (Pc): New constraint.
+
 2010-07-20  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/45006
index e597eb3a745d683c1aaf46c9ee157dae11bdd14f..bbe65ec27ba8bd51e11c4be0e0b329d82b566596 100644 (file)
 )
 
 (define_insn_and_split "*thumb1_addsi3"
-  [(set (match_operand:SI          0 "register_operand" "=l,l,l,*rk,*hk,l,k,l,l")
-       (plus:SI (match_operand:SI 1 "register_operand" "%0,0,l,*0,*0,k,k,0,l")
-                (match_operand:SI 2 "nonmemory_operand" "I,J,lL,*hk,*rk,M,O,Pa,Pb")))]
+  [(set (match_operand:SI          0 "register_operand" "=l,l,l,*rk,*hk,l,k,l,l,l")
+       (plus:SI (match_operand:SI 1 "register_operand" "%0,0,l,*0,*0,k,k,0,l,k")
+                (match_operand:SI 2 "nonmemory_operand" "I,J,lL,*hk,*rk,M,O,Pa,Pb,Pc")))]
   "TARGET_THUMB1"
   "*
    static const char * const asms[] = 
      \"add\\t%0, %1, %2\",
      \"add\\t%0, %1, %2\",
      \"#\",
+     \"#\",
      \"#\"
    };
    if ((which_alternative == 2 || which_alternative == 6)
    return asms[which_alternative];
   "
   "&& reload_completed && CONST_INT_P (operands[2])
-   && operands[1] != stack_pointer_rtx
-   && (INTVAL (operands[2]) > 255 || INTVAL (operands[2]) < -255)"
+   && ((operands[1] != stack_pointer_rtx
+        && (INTVAL (operands[2]) > 255 || INTVAL (operands[2]) < -255))
+       || (operands[1] == stack_pointer_rtx
+          && INTVAL (operands[2]) > 1020))"
   [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))
    (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
   {
     HOST_WIDE_INT offset = INTVAL (operands[2]);
-    if (offset > 255)
-      offset = 255;
-    else if (offset < -255)
-      offset = -255;
-    
+    if (operands[1] == stack_pointer_rtx)
+      offset -= 1020;
+    else
+      {
+        if (offset > 255)
+         offset = 255;
+       else if (offset < -255)
+         offset = -255;
+      }
     operands[3] = GEN_INT (offset);
     operands[2] = GEN_INT (INTVAL (operands[2]) - offset);
   }
-  [(set_attr "length" "2,2,2,2,2,2,2,4,4")]
+  [(set_attr "length" "2,2,2,2,2,2,2,4,4,4")]
 )
 
 ;; Reloading and elimination of the frame pointer can
index 8d0d184f7bec6069d0c53a8e31ee42d41d9eb844..ee6b6256b3234288f4dedd1a594de84690e26cb6 100644 (file)
@@ -30,7 +30,7 @@
 
 ;; The following multi-letter normal constraints have been used:
 ;; in ARM/Thumb-2 state: Da, Db, Dc, Dn, Dl, DL, Dv, Dy, Di
-;; in Thumb-1 state: Pa, Pb
+;; in Thumb-1 state: Pa, Pb, Pc
 ;; in Thumb-2 state: Ps, Pt, Pu, Pv, Pw, Px
 
 ;; The following memory constraints have been used:
  (and (match_code "const_int")
       (match_test "TARGET_32BIT ? ((ival >= 0 && ival <= 32)
                                 || ((ival & (ival - 1)) == 0))
-                  : ((ival >= 0 && ival <= 1020) && ((ival & 3) == 0))")))
+                  : ival >= 0 && ival <= 1020 && (ival & 3) == 0")))
 
 (define_constraint "N"
  "Thumb-1 state a constant in the range 0-31."
        (match_test "TARGET_THUMB1 && ival >= -262 && ival <= 262
                    && (ival > 255 || ival < -255)")))
 
+(define_constraint "Pc"
+  "@internal In Thumb-1 state a constant that is in the range 1021 to 1275"
+  (and (match_code "const_int")
+       (match_test "TARGET_THUMB1
+                   && ival > 1020 && ival <= 1275")))
+
 (define_constraint "Ps"
   "@internal In Thumb-2 state a constant in the range -255 to +255"
   (and (match_code "const_int")