OSDN Git Service

* config/avr/constraints.md (Cm2): New constraint for int -2.
authorgjl <gjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 Nov 2011 18:07:56 +0000 (18:07 +0000)
committergjl <gjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 Nov 2011 18:07:56 +0000 (18:07 +0000)
* config/avr/avr.md (addqi3): Use it. New alternatives for +/-2.
(*negqihi2): New insn.

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

gcc/ChangeLog
gcc/config/avr/avr.md
gcc/config/avr/constraints.md

index 4c7bdd5..cea9a6c 100644 (file)
@@ -1,3 +1,9 @@
+2011-11-07  Georg-Johann Lay  <avr@gjlay.de>
+
+       * config/avr/constraints.md (Cm2): New constraint for int -2.
+       * config/avr/avr.md (addqi3): Use it. New alternatives for +/-2.
+       (*negqihi2): New insn.
+
 2011-11-07  H.J. Lu  <hongjiu.lu@intel.com>
 
        * dwarf2cfi.c (dwarf2out_frame_debug_expr): Check
index 12e9485..5933010 100644 (file)
 ; add bytes
 
 (define_insn "addqi3"
-  [(set (match_operand:QI 0 "register_operand" "=r,d,r,r")
-        (plus:QI (match_operand:QI 1 "register_operand" "%0,0,0,0")
-                 (match_operand:QI 2 "nonmemory_operand" "r,i,P,N")))]
+  [(set (match_operand:QI 0 "register_operand"          "=r,d,r,r,r,r")
+        (plus:QI (match_operand:QI 1 "register_operand" "%0,0,0,0,0,0")
+                 (match_operand:QI 2 "nonmemory_operand" "r,i,P,N,K,Cm2")))]
   ""
   "@
        add %0,%2
        subi %0,lo8(-(%2))
        inc %0
-       dec %0"
-  [(set_attr "length" "1,1,1,1")
-   (set_attr "cc" "set_czn,set_czn,set_zn,set_zn")])
+       dec %0
+       inc %0\;inc %0
+       dec %0\;dec %0"
+  [(set_attr "length" "1,1,1,1,2,2")
+   (set_attr "cc" "set_czn,set_czn,set_zn,set_zn,set_zn,set_zn")])
 
 
 (define_expand "addhi3"
   [(set_attr "length" "1")
    (set_attr "cc" "set_zn")])
 
+(define_insn "*negqihi2"
+  [(set (match_operand:HI 0 "register_operand"                        "=r")
+        (neg:HI (sign_extend:HI (match_operand:QI 1 "register_operand" "0"))))]
+  ""
+  "clr %B0\;neg %A0\;brge .+2\;com %B0"
+  [(set_attr "length" "4")
+   (set_attr "cc" "set_n")])
+
 (define_insn "neghi2"
   [(set (match_operand:HI 0 "register_operand"       "=!d,r,&r")
        (neg:HI (match_operand:HI 1 "register_operand" "0,0,r")))]
index 0f6a03a..50aae32 100644 (file)
   (and (match_code "mem")
        (match_test "extra_constraint_Q (op)")))
 
+(define_constraint "Cm2"
+  "Constant integer @minus{}2."
+  (and (match_code "const_int")
+       (match_test "ival == -2")))
+
 (define_constraint "C03"
   "Constant integer 3."
   (and (match_code "const_int")