summaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorgjl <gjl@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-07 18:07:56 +0000
committergjl <gjl@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-07 18:07:56 +0000
commit69a5e82f931b655a422391e2651c8e5fb6983517 (patch)
tree4b1ba7d907dc39e9b8d861d513b4c7fb656834e8 /gcc/config
parent920f5a70f4497afa3a0d5a14069404276d31d588 (diff)
downloadgcc-69a5e82f931b655a422391e2651c8e5fb6983517.tar.gz
* config/avr/constraints.md (Cm2): New constraint for int -2.
* 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
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/avr/avr.md22
-rw-r--r--gcc/config/avr/constraints.md5
2 files changed, 21 insertions, 6 deletions
diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md
index 12e94850c95..59330104fa0 100644
--- a/gcc/config/avr/avr.md
+++ b/gcc/config/avr/avr.md
@@ -752,17 +752,19 @@
; 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"
@@ -3386,6 +3388,14 @@
[(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")))]
diff --git a/gcc/config/avr/constraints.md b/gcc/config/avr/constraints.md
index 0f6a03adbf1..50aae32b01a 100644
--- a/gcc/config/avr/constraints.md
+++ b/gcc/config/avr/constraints.md
@@ -103,6 +103,11 @@
(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")