OSDN Git Service

PR target/33132
authornickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 31 Aug 2007 14:27:19 +0000 (14:27 +0000)
committernickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 31 Aug 2007 14:27:19 +0000 (14:27 +0000)
* config/m32r/constraints.md: Add W constraint for integer zero.
* config/m32r/m32r.md (get_pc): Use W and i constraints.
  Fix length calculation by using alternatives.

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

gcc/ChangeLog
gcc/config/m32r/constraints.md
gcc/config/m32r/m32r.md

index efbaba0..50832cf 100644 (file)
@@ -1,3 +1,10 @@
+2007-08-31  Nick Clifton  <nickc@redhat.com>
+
+       PR target/33132
+       * config/m32r/constraints.md: Add W constraint for integer zero.
+       * config/m32r/m32r.md (get_pc): Use W and i constraints.
+       Fix length calculation by using alternatives.
+
 2007-08-31  Richard Sandiford  <richard@codesourcery.com>
 
        * optabs.c (shift_optab_p, commutative_optab_p): New functions,
index 3608802..da126c2 100644 (file)
@@ -39,6 +39,7 @@
 ;; S is for stores with pre {inc,dec}rement
 ;; T is for indirect of a pointer.
 ;; U is for loads with post increment.
+;; W is used for an immediate value of 0.
 ;;
 ;; Register constraints
 
   "A load with post increment."
   (and (match_code "mem")
        (match_test "LOAD_POSTINC_P (GET_MODE (op), XEXP (op, 0))")))
+
+(define_constraint "W"
+  "zero immediate."
+  (and (match_code "const_int")
+       (match_test "ival == 0")))
+
index e875f96..84cf4f9 100644 (file)
 
 (define_insn "get_pc"
   [(clobber (reg:SI 14))
-   (set (match_operand 0 "register_operand" "=r")
+   (set (match_operand 0 "register_operand" "=r,r")
         (unspec [(match_operand 1 "" "")] UNSPEC_GET_PC))
-   (use (match_operand:SI 2 "immediate_operand" ""))]
+   (use (match_operand:SI 2 "immediate_operand" "W,i"))]
   "flag_pic"
-  "*
-{
-  if (INTVAL(operands[2]))
-    return \"bl.s .+4\;ld24 %0,%#%1\;add %0,lr\";
-  else
-    return \"bl.s .+4\;seth %0,%#shigh(%1)\;add3 %0,%0,%#low(%1+4)\;add %0,lr\";}"
-  [(set (attr "length") (if_then_else (ne (match_dup 2) (const_int 0))
-                                      (const_int 8)
-                                      (const_int 12)))])
+  "@
+   bl.s .+4\;seth %0,%#shigh(%1)\;add3 %0,%0,%#low(%1+4)\;add %0,lr
+   bl.s .+4\;ld24 %0,%#%1\;add %0,lr"
+  [(set_attr "length" "12,8")])
 
 (define_expand "builtin_setjmp_receiver"
   [(label_ref (match_operand 0 "" ""))]