Commit 1edaa8b7 by Georg-Johann Lay Committed by Georg-Johann Lay

avr.md (eqne): New code iterator.

	* config/avr/avr.md (eqne): New code iterator.
	(*dec-and-branchsi): Use it in text peephole's condition.
	(*dec-and-branchhi): Ditto.
	(*dec-and-branchqi): Ditto.

From-SVN: r184658
parent e80cd3b0
2012-02-29 Georg-Johann Lay <avr@gjlay.de> 2012-02-29 Georg-Johann Lay <avr@gjlay.de>
* config/avr/avr.md: Untabify.
2012-02-29 Georg-Johann Lay <avr@gjlay.de>
* config/avr/avr.md (eqne): New code iterator.
(*dec-and-branchsi): Use it in text peephole's condition.
(*dec-and-branchhi): Ditto.
(*dec-and-branchqi): Ditto.
2012-02-29 Georg-Johann Lay <avr@gjlay.de>
PR target/49939 PR target/49939
* config/avr/avr.h (ASM_SPEC): Add -mno-skip-bug if we know that * config/avr/avr.h (ASM_SPEC): Add -mno-skip-bug if we know that
the device does not have the skip-bug. the device does not have the skip-bug.
......
...@@ -232,6 +232,7 @@ ...@@ -232,6 +232,7 @@
(define_code_iterator any_extend2 [sign_extend zero_extend]) (define_code_iterator any_extend2 [sign_extend zero_extend])
(define_code_iterator xior [xor ior]) (define_code_iterator xior [xor ior])
(define_code_iterator eqne [eq ne])
;; Define code attributes ;; Define code attributes
(define_code_attr extend_su (define_code_attr extend_su
...@@ -4939,12 +4940,14 @@ ...@@ -4939,12 +4940,14 @@
(const_int -1))) (const_int -1)))
(clobber (match_operand:QI 1 "d_register_operand" ""))]) (clobber (match_operand:QI 1 "d_register_operand" ""))])
(set (pc) (set (pc)
(if_then_else (ne (cc0) (if_then_else (eqne (cc0)
(const_int 0)) (const_int 0))
(label_ref (match_operand 2 "" "")) (label_ref (match_operand 2 "" ""))
(pc)))] (pc)))]
"" ""
{ {
const char *op;
int jump_mode;
CC_STATUS_INIT; CC_STATUS_INIT;
if (test_hard_reg_class (ADDW_REGS, operands[0])) if (test_hard_reg_class (ADDW_REGS, operands[0]))
output_asm_insn ("sbiw %0,1" CR_TAB output_asm_insn ("sbiw %0,1" CR_TAB
...@@ -4956,14 +4959,15 @@ ...@@ -4956,14 +4959,15 @@
"sbc %C0,__zero_reg__" CR_TAB "sbc %C0,__zero_reg__" CR_TAB
"sbc %D0,__zero_reg__", operands); "sbc %D0,__zero_reg__", operands);
switch (avr_jump_mode (operands[2], insn)) jump_mode = avr_jump_mode (operands[2], insn);
op = ((EQ == <CODE>) ^ (jump_mode == 1)) ? "brcc" : "brcs";
operands[1] = gen_rtx_CONST_STRING (VOIDmode, op);
switch (jump_mode)
{ {
case 1: case 1: return "%1 %2";
return "brcc %2"; case 2: return "%1 .+2\;rjmp %2";
case 2: case 3: return "%1 .+4\;jmp %2";
return "brcs .+2\;rjmp %2";
case 3:
return "brcs .+4\;jmp %2";
} }
gcc_unreachable(); gcc_unreachable();
...@@ -4974,17 +4978,19 @@ ...@@ -4974,17 +4978,19 @@
[(set (match_operand:HI 0 "d_register_operand" "") [(set (match_operand:HI 0 "d_register_operand" "")
(plus:HI (match_dup 0) (plus:HI (match_dup 0)
(const_int -1))) (const_int -1)))
(parallel (parallel [(set (cc0)
[(set (cc0)
(compare (match_dup 0) (compare (match_dup 0)
(const_int -1))) (const_int -1)))
(clobber (match_operand:QI 1 "d_register_operand" ""))]) (clobber (match_operand:QI 1 "d_register_operand" ""))])
(set (pc) (set (pc)
(if_then_else (ne (cc0) (const_int 0)) (if_then_else (eqne (cc0)
(const_int 0))
(label_ref (match_operand 2 "" "")) (label_ref (match_operand 2 "" ""))
(pc)))] (pc)))]
"" ""
{ {
const char *op;
int jump_mode;
CC_STATUS_INIT; CC_STATUS_INIT;
if (test_hard_reg_class (ADDW_REGS, operands[0])) if (test_hard_reg_class (ADDW_REGS, operands[0]))
output_asm_insn ("sbiw %0,1", operands); output_asm_insn ("sbiw %0,1", operands);
...@@ -4992,14 +4998,15 @@ ...@@ -4992,14 +4998,15 @@
output_asm_insn ("subi %A0,1" CR_TAB output_asm_insn ("subi %A0,1" CR_TAB
"sbc %B0,__zero_reg__", operands); "sbc %B0,__zero_reg__", operands);
switch (avr_jump_mode (operands[2], insn)) jump_mode = avr_jump_mode (operands[2], insn);
op = ((EQ == <CODE>) ^ (jump_mode == 1)) ? "brcc" : "brcs";
operands[1] = gen_rtx_CONST_STRING (VOIDmode, op);
switch (jump_mode)
{ {
case 1: case 1: return "%1 %2";
return "brcc %2"; case 2: return "%1 .+2\;rjmp %2";
case 2: case 3: return "%1 .+4\;jmp %2";
return "brcs .+2\;rjmp %2";
case 3:
return "brcs .+4\;jmp %2";
} }
gcc_unreachable(); gcc_unreachable();
...@@ -5017,12 +5024,14 @@ ...@@ -5017,12 +5024,14 @@
(const_int -1))) (const_int -1)))
(clobber (match_operand:QI 1 "d_register_operand" ""))]) (clobber (match_operand:QI 1 "d_register_operand" ""))])
(set (pc) (set (pc)
(if_then_else (ne (cc0) (if_then_else (eqne (cc0)
(const_int 0)) (const_int 0))
(label_ref (match_operand 2 "" "")) (label_ref (match_operand 2 "" ""))
(pc)))] (pc)))]
"" ""
{ {
const char *op;
int jump_mode;
CC_STATUS_INIT; CC_STATUS_INIT;
if (test_hard_reg_class (ADDW_REGS, operands[0])) if (test_hard_reg_class (ADDW_REGS, operands[0]))
output_asm_insn ("sbiw %0,1", operands); output_asm_insn ("sbiw %0,1", operands);
...@@ -5030,14 +5039,15 @@ ...@@ -5030,14 +5039,15 @@
output_asm_insn ("subi %A0,1" CR_TAB output_asm_insn ("subi %A0,1" CR_TAB
"sbc %B0,__zero_reg__", operands); "sbc %B0,__zero_reg__", operands);
switch (avr_jump_mode (operands[2], insn)) jump_mode = avr_jump_mode (operands[2], insn);
op = ((EQ == <CODE>) ^ (jump_mode == 1)) ? "brcc" : "brcs";
operands[1] = gen_rtx_CONST_STRING (VOIDmode, op);
switch (jump_mode)
{ {
case 1: case 1: return "%1 %2";
return "brcc %2"; case 2: return "%1 .+2\;rjmp %2";
case 2: case 3: return "%1 .+4\;jmp %2";
return "brcs .+2\;rjmp %2";
case 3:
return "brcs .+4\;jmp %2";
} }
gcc_unreachable(); gcc_unreachable();
...@@ -5055,25 +5065,28 @@ ...@@ -5055,25 +5065,28 @@
(const_int -1))) (const_int -1)))
(clobber (match_operand:QI 1 "d_register_operand" ""))]) (clobber (match_operand:QI 1 "d_register_operand" ""))])
(set (pc) (set (pc)
(if_then_else (ne (cc0) (if_then_else (eqne (cc0)
(const_int 0)) (const_int 0))
(label_ref (match_operand 2 "" "")) (label_ref (match_operand 2 "" ""))
(pc)))] (pc)))]
"" ""
{ {
const char *op;
int jump_mode;
CC_STATUS_INIT; CC_STATUS_INIT;
output_asm_insn ("ldi %3,1" CR_TAB output_asm_insn ("ldi %3,1" CR_TAB
"sub %A0,%3" CR_TAB "sub %A0,%3" CR_TAB
"sbc %B0,__zero_reg__", operands); "sbc %B0,__zero_reg__", operands);
switch (avr_jump_mode (operands[2], insn)) jump_mode = avr_jump_mode (operands[2], insn);
op = ((EQ == <CODE>) ^ (jump_mode == 1)) ? "brcc" : "brcs";
operands[1] = gen_rtx_CONST_STRING (VOIDmode, op);
switch (jump_mode)
{ {
case 1: case 1: return "%1 %2";
return "brcc %2"; case 2: return "%1 .+2\;rjmp %2";
case 2: case 3: return "%1 .+4\;jmp %2";
return "brcs .+2\;rjmp %2";
case 3:
return "brcs .+4\;jmp %2";
} }
gcc_unreachable(); gcc_unreachable();
...@@ -5088,25 +5101,29 @@ ...@@ -5088,25 +5101,29 @@
(compare (match_dup 0) (compare (match_dup 0)
(const_int -1))) (const_int -1)))
(set (pc) (set (pc)
(if_then_else (ne (cc0) (const_int 0)) (if_then_else (eqne (cc0)
(const_int 0))
(label_ref (match_operand 1 "" "")) (label_ref (match_operand 1 "" ""))
(pc)))] (pc)))]
"" ""
{ {
const char *op;
int jump_mode;
CC_STATUS_INIT; CC_STATUS_INIT;
cc_status.value1 = operands[0]; cc_status.value1 = operands[0];
cc_status.flags |= CC_OVERFLOW_UNUSABLE; cc_status.flags |= CC_OVERFLOW_UNUSABLE;
output_asm_insn ("subi %A0,1", operands); output_asm_insn ("subi %A0,1", operands);
switch (avr_jump_mode (operands[1], insn)) jump_mode = avr_jump_mode (operands[1], insn);
op = ((EQ == <CODE>) ^ (jump_mode == 1)) ? "brcc" : "brcs";
operands[0] = gen_rtx_CONST_STRING (VOIDmode, op);
switch (jump_mode)
{ {
case 1: case 1: return "%0 %1";
return "brcc %1"; case 2: return "%0 .+2\;rjmp %1";
case 2: case 3: return "%0 .+4\;jmp %1";
return "brcs .+2\;rjmp %1";
case 3:
return "brcs .+4\;jmp %1";
} }
gcc_unreachable(); gcc_unreachable();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment