&& XVECLEN (PATTERN (insn), 0) == 3
&& REG_P (operands[3]));
bool ldi_ok = test_hard_reg_class (LD_REGS, operands[0]);
+ bool reg1_unused_after = reg_unused_after (insn, operands[1]);
if (plen)
*plen = 0;
"mov %B0,%A0" CR_TAB
"mov %A0,__tmp_reg__", operands, plen, 9);
case 7:
- return avr_asm_len ("lsr %B0" CR_TAB
- "mov %B0,%A0" CR_TAB
- "clr %A0" CR_TAB
- "ror %B0" CR_TAB
- "ror %A0", operands, plen, 5);
+ return reg1_unused_after
+ ? avr_asm_len ("lsr %B1" CR_TAB
+ "mov %B0,%A1" CR_TAB
+ "clr %A0" CR_TAB
+ "ror %B0" CR_TAB
+ "ror %A0", operands, plen, 5)
+ : avr_asm_len ("bst %B1,0" CR_TAB
+ "mov %B0,%A1" CR_TAB
+ "clr %A0" CR_TAB
+ "ror %B0" CR_TAB
+ "ror %A0" CR_TAB
+ "bld %B0,7", operands, plen, 6);
case 8:
return avr_asm_len ("mov %B0,%A1" CR_TAB
"clr %A0", operands, plen, 2);
case 9:
- return avr_asm_len ("mov %B0,%A0" CR_TAB
+ return avr_asm_len ("mov %B0,%A1" CR_TAB
"clr %A0" CR_TAB
"lsl %B0", operands, plen, 3);
case 10:
- return avr_asm_len ("mov %B0,%A0" CR_TAB
+ return avr_asm_len ("mov %B0,%A1" CR_TAB
"clr %A0" CR_TAB
"lsl %B0" CR_TAB
"lsl %B0", operands, plen, 4);
case 11:
- return avr_asm_len ("mov %B0,%A0" CR_TAB
+ return avr_asm_len ("mov %B0,%A1" CR_TAB
"clr %A0" CR_TAB
"lsl %B0" CR_TAB
"lsl %B0" CR_TAB
"lsl %B0", operands, plen, 5);
case 12:
if (ldi_ok)
- return avr_asm_len ("mov %B0,%A0" CR_TAB
+ return avr_asm_len ("mov %B0,%A1" CR_TAB
"clr %A0" CR_TAB
"swap %B0" CR_TAB
"andi %B0,0xf0", operands, plen, 4);
if (scratch)
- return avr_asm_len ("mov %B0,%A0" CR_TAB
+ return avr_asm_len ("mov %B0,%A1" CR_TAB
"clr %A0" CR_TAB
"swap %B0" CR_TAB
"ldi %3,0xf0" CR_TAB
"and %B0,%3", operands, plen, 5);
- return avr_asm_len ("mov %B0,%A0" CR_TAB
+ return avr_asm_len ("mov %B0,%A1" CR_TAB
"clr %A0" CR_TAB
"lsl %B0" CR_TAB
"lsl %B0" CR_TAB
*plen = 0;
const int offs = INTVAL (operands[2]);
+ bool reg1_unused_after = reg_unused_after (insn, operands[1]);
if (IN_RANGE (offs, 0, 5))
{
}
else if (offs == 6)
{
- return avr_asm_len ("bst %0,6" CR_TAB
- "lsl %0" CR_TAB
- "sbc %0,%0" CR_TAB
- "bld %0,0", operands, plen, 4);
+ return reg1_unused_after
+ ? avr_asm_len ("bst %1,6" CR_TAB
+ "lsl %1" CR_TAB
+ "sbc %0,%0" CR_TAB
+ "bld %0,0", operands, plen, 4)
+ : avr_asm_len ("mov %0,%1" CR_TAB
+ "bst %0,6" CR_TAB
+ "lsl %0" CR_TAB
+ "sbc %0,%0" CR_TAB
+ "bld %0,0", operands, plen, 5);
}
else if (offs >= 7)
{
&& XVECLEN (PATTERN (insn), 0) == 3
&& REG_P (operands[3]));
bool ldi_ok = test_hard_reg_class (LD_REGS, operands[0]);
+ bool reg1_unused_after = reg_unused_after (insn, operands[1]);
if (plen)
*plen = 0;
"asr %A0" CR_TAB
"asr %A0", operands, plen, 8);
case 14:
- return avr_asm_len ("lsl %B0" CR_TAB
- "sbc %A0,%A0" CR_TAB
- "lsl %B0" CR_TAB
- "mov %B0,%A0" CR_TAB
- "rol %A0", operands, plen, 5);
+ return reg1_unused_after
+ ? avr_asm_len ("bst %B1,6" CR_TAB
+ "lsl %B1" CR_TAB
+ "sbc %B0,%B0" CR_TAB
+ "sbc %A0,%A0" CR_TAB
+ "bld %A0,0", operands, plen, 5)
+ : avr_asm_len ("mov %B0,%B1" CR_TAB
+ "bst %B0,6" CR_TAB
+ "lsl %B0" CR_TAB
+ "sbc %B0,%B0" CR_TAB
+ "sbc %A0,%A0" CR_TAB
+ "bld %A0,0", operands, plen, 6);
default:
if (INTVAL (operands[2]) < 16)
break;
if (plen)
*plen = 0;
+ bool reg1_unused_after = reg_unused_after (insn, op[1]);
+
switch (INTVAL (op[2]))
{
case 8:
"sbrc %A0,7" CR_TAB
"com %B0" CR_TAB
"mov %C0,%B0", op, plen, 4);
+ case 22:
+ {
+ rtx xop[2] = { op[0], op[1] };
+ if (! reg1_unused_after)
+ {
+ avr_asm_len ("mov %C0,%C1", xop, plen, 1);
+ xop[1] = xop[0];
+ }
+ return avr_asm_len ("bst %C1,6" CR_TAB
+ "lsl %C1" CR_TAB
+ "sbc %C0,%C0" CR_TAB
+ "sbc %B0,%B0" CR_TAB
+ "sbc %A0,%A0" CR_TAB
+ "bld %A0,0", xop, plen, 6);
+ }
+
default:
if (INTVAL (op[2]) < 24)
break;
case 23:
{
rtx xop[2] = { op[0], op[1] };
- if (! reg_unused_after (insn, xop[1]))
+ if (! reg1_unused_after)
{
avr_asm_len ("mov %C0,%C1", xop, plen, 1);
xop[1] = xop[0];
int reg0 = true_regnum (operands[0]);
int reg1 = true_regnum (operands[1]);
+ bool reg1_unused_after = reg_unused_after (insn, operands[1]);
switch (INTVAL (operands[2]))
{
"com %D0" CR_TAB
"mov %B0,%D0" CR_TAB
"mov %C0,%D0", operands, plen, 6);
+ case 30:
+ {
+ rtx xop[2] = { operands[0], operands[1] };
+ if (! reg1_unused_after)
+ {
+ avr_asm_len ("mov %D0,%D1", xop, plen, 1);
+ xop[1] = xop[0];
+ }
+ avr_asm_len ("bst %D1,6" CR_TAB
+ "lsl %D1" CR_TAB
+ "sbc %A0,%A0" CR_TAB
+ "sbc %B0,%B0", xop, plen, 4);
+ return AVR_HAVE_MOVW
+ ? avr_asm_len ("movw %C0,%A0" CR_TAB
+ "bld %A0,0", xop, plen, 2)
+ : avr_asm_len ("mov %C0,%A0" CR_TAB
+ "mov %D0,%A0" CR_TAB
+ "bld %A0,0", xop, plen, 3);
+ }
+
default:
if (INTVAL (operands[2]) < 32)
break;
case 31:
{
rtx xop[2] = { operands[0], operands[1] };
- if (! reg_unused_after (insn, xop[1]))
+ if (! reg1_unused_after)
{
avr_asm_len ("mov %D0,%D1", xop, plen, 1);
xop[1] = xop[0];
&& XVECLEN (PATTERN (insn), 0) == 3
&& REG_P (operands[3]));
bool ldi_ok = test_hard_reg_class (LD_REGS, operands[0]);
+ bool reg1_unused_after = reg_unused_after (insn, operands[1]);
if (plen)
*plen = 0;
"mov %A0,%B0" CR_TAB
"mov %B0,__tmp_reg__", operands, plen, 9);
case 7:
- return avr_asm_len ("lsl %A0" CR_TAB
- "mov %A0,%B0" CR_TAB
- "rol %A0" CR_TAB
- "sbc %B0,%B0" CR_TAB
- "neg %B0", operands, plen, 5);
+ return reg1_unused_after
+ ? avr_asm_len ("lsl %A1" CR_TAB
+ "mov %A0,%B1" CR_TAB
+ "rol %A0" CR_TAB
+ "sbc %B0,%B0" CR_TAB
+ "neg %B0", operands, plen, 5)
+ : avr_asm_len ("bst %A1,7" CR_TAB
+ "mov %A0,%B1" CR_TAB
+ "rol %A0" CR_TAB
+ "sbc %B0,%B0" CR_TAB
+ "neg %B0" CR_TAB
+ "bld %A0,0", operands, plen, 6);
case 8:
return avr_asm_len ("mov %A0,%B1" CR_TAB
"clr %B0", operands, plen, 2);
case 9:
- return avr_asm_len ("mov %A0,%B0" CR_TAB
+ return avr_asm_len ("mov %A0,%B1" CR_TAB
"clr %B0" CR_TAB
"lsr %A0", operands, plen, 3);
case 10:
- return avr_asm_len ("mov %A0,%B0" CR_TAB
+ return avr_asm_len ("mov %A0,%B1" CR_TAB
"clr %B0" CR_TAB
"lsr %A0" CR_TAB
"lsr %A0", operands, plen, 4);
case 11:
- return avr_asm_len ("mov %A0,%B0" CR_TAB
+ return avr_asm_len ("mov %A0,%B1" CR_TAB
"clr %B0" CR_TAB
"lsr %A0" CR_TAB
"lsr %A0" CR_TAB
"lsr %A0", operands, plen, 5);
case 12:
if (ldi_ok)
- return avr_asm_len ("mov %A0,%B0" CR_TAB
+ return avr_asm_len ("mov %A0,%B1" CR_TAB
"clr %B0" CR_TAB
"swap %A0" CR_TAB
"andi %A0,0x0f", operands, plen, 4);
return scratch
- ? avr_asm_len ("mov %A0,%B0" CR_TAB
+ ? avr_asm_len ("mov %A0,%B1" CR_TAB
"clr %B0" CR_TAB
"swap %A0" CR_TAB
"ldi %3,0x0f" CR_TAB
"and %A0,%3", operands, plen, 5)
- : avr_asm_len ("mov %A0,%B0" CR_TAB
+ : avr_asm_len ("mov %A0,%B1" CR_TAB
"clr %B0" CR_TAB
"lsr %A0" CR_TAB
"lsr %A0" CR_TAB
{
int reg0 = true_regnum (operands[0]);
int reg1 = true_regnum (operands[1]);
+ bool reg1_unused_after_p = reg_unused_after (insn, operands[1]);
if (plen)
*plen = 0;
"mov %C0,%D1" CR_TAB
"mov %B0,%C1" CR_TAB
"mov %A0,%B1", operands, plen, 4);
+ case 15:
+ avr_asm_len (reg1_unused_after_p
+ ? "lsl %B1"
+ : "bst %B1,7", operands, plen, 1);
+ if (reg0 != reg1 + 2)
+ {
+ if (AVR_HAVE_MOVW)
+ avr_asm_len ("movw %A0,%C1", operands, plen, 1);
+ else
+ avr_asm_len ("mov %A0,%C1" CR_TAB
+ "mov %B0,%D1", operands, plen, 2);
+ }
+ return reg1_unused_after_p
+ ? avr_asm_len ("clr %D0" CR_TAB
+ "clr %C0" CR_TAB
+ "rol %A0" CR_TAB
+ "rol %B0" CR_TAB
+ "rol %C0", operands, plen, 5)
+ : avr_asm_len ("clr %D0" CR_TAB
+ "clr %C0" CR_TAB
+ "lsl %A0" CR_TAB
+ "rol %B0" CR_TAB
+ "rol %C0" CR_TAB
+ "bld %A0,0", operands, plen, 6);
case 16:
if (reg0 == reg1 + 2)
return avr_asm_len ("clr %C0" CR_TAB
case 8:
*total = COSTS_N_INSNS (5);
break;
+ case 22:
+ *total = COSTS_N_INSNS (6);
+ break;
case 23:
*total = COSTS_N_INSNS (4);
break;
case 2:
*total = COSTS_N_INSNS (!speed ? 7 : 8);
break;
+ case 30:
+ *total = COSTS_N_INSNS (7 - AVR_HAVE_MOVW);
+ break;
case 31:
*total = COSTS_N_INSNS (AVR_HAVE_MOVW ? 4 : 5);
break;
case 2:
*total = COSTS_N_INSNS (!speed ? 7 : 8);
break;
- case 8:
+ case 15:
+ *total = COSTS_N_INSNS (8 - AVR_HAVE_MOVW);
+ break;
case 16:
+ *total = COSTS_N_INSNS (4 - AVR_HAVE_MOVW);
+ break;
+ case 8:
case 24:
*total = COSTS_N_INSNS (4);
break;
[(set_attr "length" "5,0,1,2,3,4,6,9")
(set_attr "adjust_len" "ashlqi")])
+;; "ashlhi3"
+;; "ashlhq3" "ashluhq3"
+;; "ashlha3" "ashluha3"
(define_insn_and_split "ashl<mode>3"
- [(set (match_operand:ALL2 0 "register_operand" "=r,r,r,r ,r,r,r")
- (ashift:ALL2 (match_operand:ALL2 1 "register_operand" "0,0,0,r ,0,0,0")
- (match_operand:QI 2 "nop_general_operand" "r,L,P,O C15,K,n,Qm")))]
+ [(set (match_operand:ALL2 0 "register_operand" "=r,r ,r ,r,r")
+ (ashift:ALL2 (match_operand:ALL2 1 "register_operand" "0,0 ,r ,0,0")
+ (match_operand:QI 2 "nop_general_operand" "r,LPK,O C7c C15,n,Qm")))]
""
"#"
"&& reload_completed"
(match_dup 2)))
(clobber (reg:CC REG_CC))])])
+;; "*ashlhi3"
+;; "*ashlhq3" "*ashluhq3"
+;; "*ashlha3" "*ashluha3"
(define_insn "*ashl<mode>3"
- [(set (match_operand:ALL2 0 "register_operand" "=r,r,r,r ,r,r,r")
- (ashift:ALL2 (match_operand:ALL2 1 "register_operand" "0,0,0,r ,0,0,0")
- (match_operand:QI 2 "nop_general_operand" "r,L,P,O C15,K,n,Qm")))
+ [(set (match_operand:ALL2 0 "register_operand" "=r,r ,r ,r,r")
+ (ashift:ALL2 (match_operand:ALL2 1 "register_operand" "0,0 ,r ,0,0")
+ (match_operand:QI 2 "nop_general_operand" "r,LPK,O C7c C15,n,Qm")))
(clobber (reg:CC REG_CC))]
"reload_completed"
{
return ashlhi3_out (insn, operands, NULL);
}
- [(set_attr "length" "6,0,2,3,4,10,10")
+ [(set_attr "length" "10")
(set_attr "adjust_len" "ashlhi")])
operands[2] = avr_to_int_mode (operands[0]);
})
-(define_peephole2
+(define_peephole2 ; *ashlhi3_const *ashrhi3_const *lshrhi3_const
[(match_scratch:QI 3 "d")
- (parallel [(set (match_operand:ALL2 0 "register_operand" "")
- (ashift:ALL2 (match_operand:ALL2 1 "register_operand" "")
- (match_operand:QI 2 "const_int_operand" "")))
- (clobber (reg:CC REG_CC))])]
+ (parallel [(set (match_operand:ALL2 0 "register_operand")
+ (any_shift:ALL2 (match_operand:ALL2 1 "register_operand")
+ (match_operand:QI 2 "const_int_operand")))
+ (clobber (reg:CC REG_CC))])
+ ;; Don't allow $3 to overlap with $0.
+ (match_dup 3)]
""
[(parallel [(set (match_dup 0)
- (ashift:ALL2 (match_dup 1)
- (match_dup 2)))
+ (any_shift:ALL2 (match_dup 1)
+ (match_dup 2)))
(clobber (match_dup 3))
(clobber (reg:CC REG_CC))])])
;; "*ashlhi3_const"
;; "*ashlhq3_const" "*ashluhq3_const"
;; "*ashlha3_const" "*ashluha3_const"
-(define_insn_and_split "*ashl<mode>3_const_split"
- [(set (match_operand:ALL2 0 "register_operand" "=r,r,r ,r,r")
- (ashift:ALL2 (match_operand:ALL2 1 "register_operand" "0,0,r ,0,0")
- (match_operand:QI 2 "const_int_operand" "L,P,O C15,K,n")))
- (clobber (match_scratch:QI 3 "=X,X,X ,X,&d"))]
- "reload_completed"
- "#"
- "&& reload_completed"
- [(parallel [(set (match_dup 0)
- (ashift:ALL2 (match_dup 1)
- (match_dup 2)))
- (clobber (match_dup 3))
- (clobber (reg:CC REG_CC))])])
-
(define_insn "*ashl<mode>3_const"
- [(set (match_operand:ALL2 0 "register_operand" "=r,r,r ,r,r")
- (ashift:ALL2 (match_operand:ALL2 1 "register_operand" "0,0,r ,0,0")
- (match_operand:QI 2 "const_int_operand" "L,P,O C15,K,n")))
- (clobber (match_scratch:QI 3 "=X,X,X ,X,&d"))
+ [(set (match_operand:ALL2 0 "register_operand" "=r ,r ,r")
+ (ashift:ALL2 (match_operand:ALL2 1 "register_operand" "0 ,r ,0")
+ (match_operand:QI 2 "const_int_operand" "LPK,O C7c C15,n")))
+ (clobber (match_scratch:QI 3 "=X ,X ,&d"))
(clobber (reg:CC REG_CC))]
"reload_completed"
{
return ashlhi3_out (insn, operands, NULL);
}
- [(set_attr "length" "0,2,2,4,10")
+ [(set_attr "length" "10")
(set_attr "adjust_len" "ashlhi")])
+(define_code_attr constr_split_shift4
+ [(ashift "C4l")
+ (ashiftrt "C4a")
+ (lshiftrt "C4r")])
;; Split shift into a byte shift and a residual bit shift (without scratch)
(define_split
[(parallel [(set (match_operand:ALL4 0 "register_operand")
- (ashift:ALL4 (match_operand:ALL4 1 "register_operand")
- (match_operand:QI 2 "const_int_operand")))
+ (any_shift:ALL4 (match_operand:ALL4 1 "register_operand")
+ (match_operand:QI 2 "const_int_operand")))
(clobber (reg:CC REG_CC))])]
"avropt_split_bit_shift
&& n_avr_fuse_add_executed >= 1
- && satisfies_constraint_C4l (operands[2])"
+ && satisfies_constraint_<constr_split_shift4> (operands[2])"
[(parallel [(set (match_dup 0)
- (ashift:ALL4 (match_dup 1)
- (match_dup 3)))
+ (any_shift:ALL4 (match_dup 1)
+ (match_dup 3)))
(clobber (reg:CC REG_CC))])
(parallel [(set (match_dup 0)
- (ashift:ALL4 (match_dup 0)
- (match_dup 4)))
+ (any_shift:ALL4 (match_dup 0)
+ (match_dup 4)))
(clobber (reg:CC REG_CC))])]
{
- if (avr_split_shift (operands, NULL_RTX, ASHIFT))
+ if (avr_split_shift (operands, NULL_RTX, <CODE>))
DONE;
else if (REGNO (operands[0]) == REGNO (operands[1]))
FAIL;
;; Split shift into a byte shift and a residual bit shift (with scratch)
(define_split
[(parallel [(set (match_operand:ALL4 0 "register_operand")
- (ashift:ALL4 (match_operand:ALL4 1 "register_operand")
- (match_operand:QI 2 "const_int_operand")))
- (clobber (match_operand:QI 3 "scratch_or_d_register_operand"))
+ (any_shift:ALL4 (match_operand:ALL4 1 "register_operand")
+ (match_operand:QI 2 "const_int_operand")))
+ (clobber (match_operand:QI 3 "scratch_or_dreg_operand"))
(clobber (reg:CC REG_CC))])]
"avropt_split_bit_shift
&& n_avr_fuse_add_executed >= 1
- && satisfies_constraint_C4l (operands[2])"
+ && satisfies_constraint_<constr_split_shift4> (operands[2])"
[(parallel [(set (match_dup 0)
- (ashift:ALL4 (match_dup 1)
- (match_dup 4)))
+ (any_shift:ALL4 (match_dup 1)
+ (match_dup 4)))
(clobber (reg:CC REG_CC))])
(parallel [(set (match_dup 0)
- (ashift:ALL4 (match_dup 0)
- (match_dup 5)))
+ (any_shift:ALL4 (match_dup 0)
+ (match_dup 5)))
(clobber (match_dup 3))
(clobber (reg:CC REG_CC))])]
{
- if (avr_split_shift (operands, operands[3], ASHIFT))
+ if (avr_split_shift (operands, operands[3], <CODE>))
DONE;
else if (REGNO (operands[0]) == REGNO (operands[1]))
FAIL;
})
-(define_peephole2
+;; Endow 4-byte shift with a scratch if available.
+(define_peephole2 ; *ashrsi3_const *lshrsi3_const *ashlsi3_const
[(match_scratch:QI 3 "d")
- (parallel [(set (match_operand:ALL4 0 "register_operand" "")
- (ashift:ALL4 (match_operand:ALL4 1 "register_operand" "")
- (match_operand:QI 2 "const_int_operand" "")))
+ (parallel [(set (match_operand:ALL4 0 "register_operand")
+ (any_shift:ALL4 (match_operand:ALL4 1 "register_operand")
+ (match_operand:QI 2 "const_int_operand")))
(clobber (reg:CC REG_CC))])
;; $3 must not overlap with the output of the insn above.
(match_dup 3)]
""
[(parallel [(set (match_dup 0)
- (ashift:ALL4 (match_dup 1)
- (match_dup 2)))
+ (any_shift:ALL4 (match_dup 1)
+ (match_dup 2)))
(clobber (match_dup 3))
(clobber (reg:CC REG_CC))])])
+;; "*ashlsi3_const"
+;; "*ashlsq3_const" "*ashlusq3_const"
+;; "*ashlsa3_const" "*ashlusa3_const"
(define_insn "*ashl<mode>3_const"
- [(set (match_operand:ALL4 0 "register_operand" "=r ,r ,r ,r ,r")
- (ashift:ALL4 (match_operand:ALL4 1 "register_operand" "0 ,r ,0 ,r ,0")
- (match_operand:QI 2 "const_int_operand" "LP,O C15 C31,C4l,C4l,n")))
- (clobber (match_operand:QI 3 "scratch_or_d_register_operand" "=X ,X ,&d ,&d ,&d"))
+ [(set (match_operand:ALL4 0 "register_operand" "=r ,r ,r ,r ,r")
+ (ashift:ALL4 (match_operand:ALL4 1 "register_operand" "0 ,r ,0 ,r ,0")
+ (match_operand:QI 2 "const_int_operand" "LP,O C15 C31,C4l,C4l,n")))
+ (clobber (match_operand:QI 3 "scratch_or_dreg_operand" "=X ,X ,&d ,&d ,&d"))
(clobber (reg:CC REG_CC))]
"reload_completed"
{
;; "ashrqi3"
;; "ashrqq3" "ashruqq3"
(define_insn_and_split "ashr<mode>3"
- [(set (match_operand:ALL1 0 "register_operand" "=r,r,r,r,r ,r ,r ,r")
- (ashiftrt:ALL1 (match_operand:ALL1 1 "register_operand" "0,0,0,0,0 ,0 ,r ,0")
- (match_operand:QI 2 "nop_general_operand" "r,L,P,K,C03 C04 C05,C06,C07,Qm")))]
+ [(set (match_operand:ALL1 0 "register_operand" "=r,r ,r ,r")
+ (ashiftrt:ALL1 (match_operand:ALL1 1 "register_operand" "0,0 ,r ,0")
+ (match_operand:QI 2 "nop_general_operand" "r,LPK C03 C04 C05,C06 C07,Qm")))]
""
"#"
"&& reload_completed"
(clobber (reg:CC REG_CC))])])
(define_insn "*ashr<mode>3"
- [(set (match_operand:ALL1 0 "register_operand" "=r,r,r,r,r ,r ,r ,r")
- (ashiftrt:ALL1 (match_operand:ALL1 1 "register_operand" "0,0,0,0,0 ,0 ,r ,0")
- (match_operand:QI 2 "nop_general_operand" "r,L,P,K,C03 C04 C05,C06,C07,Qm")))
+ [(set (match_operand:ALL1 0 "register_operand" "=r,r ,r ,r")
+ (ashiftrt:ALL1 (match_operand:ALL1 1 "register_operand" "0,0 ,r ,0")
+ (match_operand:QI 2 "nop_general_operand" "r,LPK C03 C04 C05,C06 C07,Qm")))
(clobber (reg:CC REG_CC))]
"reload_completed"
{
return ashrqi3_out (insn, operands, NULL);
}
- [(set_attr "length" "5,0,1,2,5,4,3,9")
+ [(set_attr "length" "9")
(set_attr "adjust_len" "ashrqi")])
;; "ashrhi3"
;; "ashrhq3" "ashruhq3"
;; "ashrha3" "ashruha3"
(define_insn_and_split "ashr<mode>3"
- [(set (match_operand:ALL2 0 "register_operand" "=r,r,r,r ,r,r,r")
- (ashiftrt:ALL2 (match_operand:ALL2 1 "register_operand" "0,0,0,r ,0,0,0")
- (match_operand:QI 2 "nop_general_operand" "r,L,P,O C15,K,n,Qm")))]
+ [(set (match_operand:ALL2 0 "register_operand" "=r,r ,r ,r,r")
+ (ashiftrt:ALL2 (match_operand:ALL2 1 "register_operand" "0,0 ,r ,0,0")
+ (match_operand:QI 2 "nop_general_operand" "r,LPK,O C14 C15,n,Qm")))]
""
"#"
"&& reload_completed"
(match_dup 2)))
(clobber (reg:CC REG_CC))])])
+;; "*ashrhi3"
+;; "*ashrhq3" "*ashruhq3"
+;; "*ashrha3" "*ashruha3"
(define_insn "*ashr<mode>3"
- [(set (match_operand:ALL2 0 "register_operand" "=r,r,r,r ,r,r,r")
- (ashiftrt:ALL2 (match_operand:ALL2 1 "register_operand" "0,0,0,r ,0,0,0")
- (match_operand:QI 2 "nop_general_operand" "r,L,P,O C15,K,n,Qm")))
+ [(set (match_operand:ALL2 0 "register_operand" "=r,r ,r ,r,r")
+ (ashiftrt:ALL2 (match_operand:ALL2 1 "register_operand" "0,0 ,r ,0,0")
+ (match_operand:QI 2 "nop_general_operand" "r,LPK,O C14 C15,n,Qm")))
(clobber (reg:CC REG_CC))]
"reload_completed"
{
return ashrhi3_out (insn, operands, NULL);
}
- [(set_attr "length" "6,0,2,5,4,10,10")
+ [(set_attr "length" "10")
(set_attr "adjust_len" "ashrhi")])
(define_insn_and_split "ashrpsi3"
- [(set (match_operand:PSI 0 "register_operand" "=r,r,r,r ,r")
- (ashiftrt:PSI (match_operand:PSI 1 "register_operand" "0,0,0,r ,0")
- (match_operand:QI 2 "nonmemory_operand" "r,P,K,O C23,n")))
- (clobber (match_scratch:QI 3 "=X,X,X,X ,&d"))]
+ [(set (match_operand:PSI 0 "register_operand" "=r,r ,r ,r")
+ (ashiftrt:PSI (match_operand:PSI 1 "register_operand" "0,0 ,r ,0")
+ (match_operand:QI 2 "nonmemory_operand" "r,PK,O C22 C23,n")))
+ (clobber (match_scratch:QI 3 "=X,X ,X ,&d"))]
""
"#"
"&& reload_completed"
(clobber (reg:CC REG_CC))])])
(define_insn "*ashrpsi3"
- [(set (match_operand:PSI 0 "register_operand" "=r,r,r,r ,r")
- (ashiftrt:PSI (match_operand:PSI 1 "register_operand" "0,0,0,r ,0")
- (match_operand:QI 2 "nonmemory_operand" "r,P,K,O C23,n")))
- (clobber (match_scratch:QI 3 "=X,X,X,X ,&d"))
+ [(set (match_operand:PSI 0 "register_operand" "=r,r ,r ,r")
+ (ashiftrt:PSI (match_operand:PSI 1 "register_operand" "0,0 ,r ,0")
+ (match_operand:QI 2 "nonmemory_operand" "r,PK,O C22 C23,n")))
+ (clobber (match_scratch:QI 3 "=X,X ,X ,&d"))
(clobber (reg:CC REG_CC))]
"reload_completed"
{
;; "ashrsq3" "ashrusq3"
;; "ashrsa3" "ashrusa3"
(define_insn_and_split "ashr<mode>3"
- [(set (match_operand:ALL4 0 "register_operand" "=r,r,r,r ,r,r,r")
- (ashiftrt:ALL4 (match_operand:ALL4 1 "register_operand" "0,0,0,r ,0,0,0")
- (match_operand:QI 2 "nop_general_operand" "r,L,P,O C31,K,n,Qm")))]
+ [(set (match_operand:ALL4 0 "register_operand" "=r,r ,r ,r ,r ,r,r")
+ (ashiftrt:ALL4 (match_operand:ALL4 1 "register_operand" "0,0 ,r ,0 ,r ,0,0")
+ (match_operand:QI 2 "nop_general_operand" "r,LPK,O C30 C31,C4a,C4a,n,Qm")))]
""
"#"
"&& reload_completed"
[(parallel [(set (match_dup 0)
(ashiftrt:ALL4 (match_dup 1)
(match_dup 2)))
- (clobber (reg:CC REG_CC))])])
+ (clobber (reg:CC REG_CC))])]
+ ""
+ [(set_attr "isa" "*,*,*,2op,3op,*,*")])
(define_insn "*ashr<mode>3"
- [(set (match_operand:ALL4 0 "register_operand" "=r,r,r,r ,r,r,r")
- (ashiftrt:ALL4 (match_operand:ALL4 1 "register_operand" "0,0,0,r ,0,0,0")
- (match_operand:QI 2 "nop_general_operand" "r,L,P,O C31,K,n,Qm")))
+ [(set (match_operand:ALL4 0 "register_operand" "=r,r ,r ,r ,r ,r,r")
+ (ashiftrt:ALL4 (match_operand:ALL4 1 "register_operand" "0,0 ,r ,0 ,r ,0,0")
+ (match_operand:QI 2 "nop_general_operand" "r,LPK,O C30 C31,C4a,C4a,n,Qm")))
(clobber (reg:CC REG_CC))]
"reload_completed"
{
return ashrsi3_out (insn, operands, NULL);
}
- [(set_attr "length" "8,0,4,6,8,10,12")
+ [(set_attr "isa" "*,*,*,2op,3op,*,*")
+ (set_attr "length" "12")
(set_attr "adjust_len" "ashrsi")])
-;; Optimize if a scratch register from LD_REGS happens to be available.
-
-(define_peephole2
- [(match_scratch:QI 3 "d")
- (parallel [(set (match_operand:ALL2 0 "register_operand" "")
- (ashiftrt:ALL2 (match_operand:ALL2 1 "register_operand" "")
- (match_operand:QI 2 "const_int_operand" "")))
- (clobber (reg:CC REG_CC))])]
- ""
- [(parallel [(set (match_dup 0)
- (ashiftrt:ALL2 (match_dup 1)
- (match_dup 2)))
- (clobber (match_dup 3))
- (clobber (reg:CC REG_CC))])])
;; "*ashrhi3_const"
;; "*ashrhq3_const" "*ashruhq3_const"
;; "*ashrha3_const" "*ashruha3_const"
-(define_insn_and_split "*ashr<mode>3_const_split"
- [(set (match_operand:ALL2 0 "register_operand" "=r,r,r ,r,r")
- (ashiftrt:ALL2 (match_operand:ALL2 1 "register_operand" "0,0,r ,0,0")
- (match_operand:QI 2 "const_int_operand" "L,P,O C15,K,n")))
- (clobber (match_scratch:QI 3 "=X,X,X ,X,&d"))]
- "reload_completed"
- "#"
- "&& reload_completed"
- [(parallel [(set (match_dup 0)
- (ashiftrt:ALL2 (match_dup 1)
- (match_dup 2)))
- (clobber (match_dup 3))
- (clobber (reg:CC REG_CC))])])
-
(define_insn "*ashr<mode>3_const"
- [(set (match_operand:ALL2 0 "register_operand" "=r,r,r ,r,r")
- (ashiftrt:ALL2 (match_operand:ALL2 1 "register_operand" "0,0,r ,0,0")
- (match_operand:QI 2 "const_int_operand" "L,P,O C15,K,n")))
- (clobber (match_scratch:QI 3 "=X,X,X ,X,&d"))
+ [(set (match_operand:ALL2 0 "register_operand" "=r ,r ,r")
+ (ashiftrt:ALL2 (match_operand:ALL2 1 "register_operand" "0 ,r ,0")
+ (match_operand:QI 2 "const_int_operand" "LPK,O C14 C15,n")))
+ (clobber (match_scratch:QI 3 "=X ,X ,&d"))
(clobber (reg:CC REG_CC))]
"reload_completed"
{
return ashrhi3_out (insn, operands, NULL);
}
- [(set_attr "length" "0,2,4,4,10")
+ [(set_attr "length" "10")
(set_attr "adjust_len" "ashrhi")])
-(define_peephole2
- [(match_scratch:QI 3 "d")
- (parallel [(set (match_operand:ALL4 0 "register_operand" "")
- (ashiftrt:ALL4 (match_operand:ALL4 1 "register_operand" "")
- (match_operand:QI 2 "const_int_operand" "")))
- (clobber (reg:CC REG_CC))])]
- ""
- [(parallel [(set (match_dup 0)
- (ashiftrt:ALL4 (match_dup 1)
- (match_dup 2)))
- (clobber (match_dup 3))
- (clobber (reg:CC REG_CC))])])
;; "*ashrsi3_const"
;; "*ashrsq3_const" "*ashrusq3_const"
;; "*ashrsa3_const" "*ashrusa3_const"
-(define_insn_and_split "*ashr<mode>3_const_split"
- [(set (match_operand:ALL4 0 "register_operand" "=r,r,r ,r")
- (ashiftrt:ALL4 (match_operand:ALL4 1 "register_operand" "0,0,r ,0")
- (match_operand:QI 2 "const_int_operand" "L,P,O C31,n")))
- (clobber (match_scratch:QI 3 "=X,X,X ,&d"))]
- "reload_completed"
- "#"
- "&& reload_completed"
- [(parallel [(set (match_dup 0)
- (ashiftrt:ALL4 (match_dup 1)
- (match_dup 2)))
- (clobber (match_dup 3))
- (clobber (reg:CC REG_CC))])])
-
(define_insn "*ashr<mode>3_const"
- [(set (match_operand:ALL4 0 "register_operand" "=r,r,r ,r")
- (ashiftrt:ALL4 (match_operand:ALL4 1 "register_operand" "0,0,r ,0")
- (match_operand:QI 2 "const_int_operand" "L,P,O C31,n")))
- (clobber (match_scratch:QI 3 "=X,X,X ,&d"))
+ [(set (match_operand:ALL4 0 "register_operand" "=r ,r ,r ,r ,r")
+ (ashiftrt:ALL4 (match_operand:ALL4 1 "register_operand" "0 ,r ,0 ,r ,0")
+ (match_operand:QI 2 "const_int_operand" "LP,O C30 C31,C4a,C4a,n")))
+ (clobber (match_operand:QI 3 "scratch_or_dreg_operand" "=X ,X ,&d ,&d ,&d"))
(clobber (reg:CC REG_CC))]
"reload_completed"
{
return ashrsi3_out (insn, operands, NULL);
}
- [(set_attr "length" "0,4,4,10")
+ [(set_attr "isa" "*,*,2op,3op,*")
+ (set_attr "length" "10")
(set_attr "adjust_len" "ashrsi")])
;; >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >>
;; "lshrhq3" "lshruhq3"
;; "lshrha3" "lshruha3"
(define_insn_and_split "lshr<mode>3"
- [(set (match_operand:ALL2 0 "register_operand" "=r,r,r,r,r ,r,r,r")
- (lshiftrt:ALL2 (match_operand:ALL2 1 "register_operand" "0,0,0,r,r ,0,0,0")
- (match_operand:QI 2 "nop_general_operand" "r,L,P,O,C15,K,n,Qm")))]
+ [(set (match_operand:ALL2 0 "register_operand" "=r,r ,r ,r,r")
+ (lshiftrt:ALL2 (match_operand:ALL2 1 "register_operand" "0,0 ,r ,0,0")
+ (match_operand:QI 2 "nop_general_operand" "r,LPK,O C7c C15,n,Qm")))]
""
"#"
"&& reload_completed"
(clobber (reg:CC REG_CC))])])
(define_insn "*lshr<mode>3"
- [(set (match_operand:ALL2 0 "register_operand" "=r,r,r,r,r ,r,r,r")
- (lshiftrt:ALL2 (match_operand:ALL2 1 "register_operand" "0,0,0,r,r ,0,0,0")
- (match_operand:QI 2 "nop_general_operand" "r,L,P,O,C15,K,n,Qm")))
+ [(set (match_operand:ALL2 0 "register_operand" "=r,r ,r ,r,r")
+ (lshiftrt:ALL2 (match_operand:ALL2 1 "register_operand" "0,0 ,r ,0,0")
+ (match_operand:QI 2 "nop_general_operand" "r,LPK,O C7c C15,n,Qm")))
(clobber (reg:CC REG_CC))]
"reload_completed"
{
;; "lshrsq3" "lshrusq3"
;; "lshrsa3" "lshrusa3"
(define_insn_and_split "lshr<mode>3"
- [(set (match_operand:ALL4 0 "register_operand" "=r,r,r,r,r,r ,r,r")
- (lshiftrt:ALL4 (match_operand:ALL4 1 "register_operand" "0,0,0,r,0,r ,0,0")
- (match_operand:QI 2 "nop_general_operand" "r,L,P,O,K,C31,n,Qm")))]
+ [(set (match_operand:ALL4 0 "register_operand" "=r,r ,r ,r ,r ,r,r")
+ (lshiftrt:ALL4 (match_operand:ALL4 1 "register_operand" "0,0 ,r ,0 ,r ,0,0")
+ (match_operand:QI 2 "nop_general_operand" "r,LPK,O C15 C31,C4r,C4r,n,Qm")))]
""
"#"
"&& reload_completed"
[(parallel [(set (match_dup 0)
(lshiftrt:ALL4 (match_dup 1)
(match_dup 2)))
- (clobber (reg:CC REG_CC))])])
+ (clobber (reg:CC REG_CC))])]
+ ""
+ [(set_attr "isa" "*,*,*,2op,3op,*,*")])
(define_insn "*lshr<mode>3"
- [(set (match_operand:ALL4 0 "register_operand" "=r,r,r,r,r,r ,r,r")
- (lshiftrt:ALL4 (match_operand:ALL4 1 "register_operand" "0,0,0,r,0,r ,0,0")
- (match_operand:QI 2 "nop_general_operand" "r,L,P,O,K,C31,n,Qm")))
+ [(set (match_operand:ALL4 0 "register_operand" "=r,r ,r ,r ,r ,r,r")
+ (lshiftrt:ALL4 (match_operand:ALL4 1 "register_operand" "0,0 ,r ,0 ,r ,0,0")
+ (match_operand:QI 2 "nop_general_operand" "r,LPK,O C15 C31,C4r,C4r,n,Qm")))
(clobber (reg:CC REG_CC))]
"reload_completed"
{
return lshrsi3_out (insn, operands, NULL);
}
- [(set_attr "adjust_len" "lshrsi")])
+ [(set_attr "isa" "*,*,*,2op,3op,*,*")
+ (set_attr "adjust_len" "lshrsi")])
;; Optimize if a scratch register from LD_REGS happens to be available.
operands[2] = avr_to_int_mode (operands[0]);
})
-(define_peephole2 ; "*lshrhi3_const"
- [(match_scratch:QI 3 "d")
- (parallel [(set (match_operand:ALL2 0 "register_operand" "")
- (lshiftrt:ALL2 (match_operand:ALL2 1 "register_operand" "")
- (match_operand:QI 2 "const_int_operand" "")))
- (clobber (reg:CC REG_CC))])]
- ""
- [(parallel [(set (match_dup 0)
- (lshiftrt:ALL2 (match_dup 1)
- (match_dup 2)))
- (clobber (match_dup 3))
- (clobber (reg:CC REG_CC))])])
;; "*lshrhi3_const"
;; "*lshrhq3_const" "*lshruhq3_const"
;; "*lshrha3_const" "*lshruha3_const"
-(define_insn_and_split "*lshr<mode>3_const_split"
- [(set (match_operand:ALL2 0 "register_operand" "=r,r,r,r ,r,r")
- (lshiftrt:ALL2 (match_operand:ALL2 1 "register_operand" "0,0,r,r ,0,0")
- (match_operand:QI 2 "const_int_operand" "L,P,O,C15,K,n")))
- (clobber (match_scratch:QI 3 "=X,X,X,X ,X,&d"))]
- "reload_completed"
- "#"
- "&& reload_completed"
- [(parallel [(set (match_dup 0)
- (lshiftrt:ALL2 (match_dup 1)
- (match_dup 2)))
- (clobber (match_dup 3))
- (clobber (reg:CC REG_CC))])])
-
(define_insn "*lshr<mode>3_const"
- [(set (match_operand:ALL2 0 "register_operand" "=r,r,r,r ,r,r")
- (lshiftrt:ALL2 (match_operand:ALL2 1 "register_operand" "0,0,r,r ,0,0")
- (match_operand:QI 2 "const_int_operand" "L,P,O,C15,K,n")))
- (clobber (match_scratch:QI 3 "=X,X,X,X ,X,&d"))
+ [(set (match_operand:ALL2 0 "register_operand" "=r ,r ,r")
+ (lshiftrt:ALL2 (match_operand:ALL2 1 "register_operand" "0 ,r ,0")
+ (match_operand:QI 2 "const_int_operand" "LPK,O C7c C15,n")))
+ (clobber (match_scratch:QI 3 "=X ,X ,&d"))
(clobber (reg:CC REG_CC))]
"reload_completed"
{
}
[(set_attr "adjust_len" "lshrhi")])
-(define_peephole2 ; "*lshrsi3_const"
- [(match_scratch:QI 3 "d")
- (parallel [(set (match_operand:ALL4 0 "register_operand" "")
- (lshiftrt:ALL4 (match_operand:ALL4 1 "register_operand" "")
- (match_operand:QI 2 "const_int_operand" "")))
- (clobber (reg:CC REG_CC))])]
- ""
- [(parallel [(set (match_dup 0)
- (lshiftrt:ALL4 (match_dup 1)
- (match_dup 2)))
- (clobber (match_dup 3))
- (clobber (reg:CC REG_CC))])])
;; "*lshrsi3_const"
;; "*lshrsq3_const" "*lshrusq3_const"
;; "*lshrsa3_const" "*lshrusa3_const"
-(define_insn_and_split "*lshr<mode>3_const_split"
- [(set (match_operand:ALL4 0 "register_operand" "=r,r,r,r ,r")
- (lshiftrt:ALL4 (match_operand:ALL4 1 "register_operand" "0,0,r,r ,0")
- (match_operand:QI 2 "const_int_operand" "L,P,O,C31,n")))
- (clobber (match_scratch:QI 3 "=X,X,X,X ,&d"))]
- "reload_completed"
- "#"
- "&& reload_completed"
- [(parallel [(set (match_dup 0)
- (lshiftrt:ALL4 (match_dup 1)
- (match_dup 2)))
- (clobber (match_dup 3))
- (clobber (reg:CC REG_CC))])])
-
(define_insn "*lshr<mode>3_const"
- [(set (match_operand:ALL4 0 "register_operand" "=r,r,r,r ,r")
- (lshiftrt:ALL4 (match_operand:ALL4 1 "register_operand" "0,0,r,r ,0")
- (match_operand:QI 2 "const_int_operand" "L,P,O,C31,n")))
- (clobber (match_scratch:QI 3 "=X,X,X,X ,&d"))
+ [(set (match_operand:ALL4 0 "register_operand" "=r ,r ,r ,r ,r")
+ (lshiftrt:ALL4 (match_operand:ALL4 1 "register_operand" "0 ,r ,0 ,r ,0")
+ (match_operand:QI 2 "const_int_operand" "LP,O C15 C31,C4r,C4r,n")))
+ (clobber (match_operand:QI 3 "scratch_or_dreg_operand" "=X ,X ,&d ,&d ,&d"))
(clobber (reg:CC REG_CC))]
"reload_completed"
{
return lshrsi3_out (insn, operands, NULL);
}
- [(set_attr "adjust_len" "lshrsi")])
+ [(set_attr "isa" "*,*,2op,3op,*")
+ (set_attr "adjust_len" "lshrsi")])
;; abs(x) abs(x) abs(x) abs(x) abs(x) abs(x) abs(x) abs(x) abs(x) abs(x) abs(x)
;; abs
[(parallel [(set (match_operand:HISI 0 "register_operand")
(plus:HISI (match_dup 0)
(match_operand:HISI 1 "nonmemory_operand")))
- (clobber (match_operand:QI 3 "scratch_or_d_register_operand"))
+ (clobber (match_operand:QI 3 "scratch_or_dreg_operand"))
(clobber (reg:CC REG_CC))])
(parallel [(set (reg:CC REG_CC)
(compare:CC (match_dup 0)
(parallel [(set (reg:CC REG_CC)
(compare:CC (match_dup 0)
(const_int -1)))
- (clobber (match_operand:QI 1 "scratch_or_d_register_operand"))])
+ (clobber (match_operand:QI 1 "scratch_or_dreg_operand"))])
(set (pc)
(if_then_else (eqne (reg:CC REG_CC)
(const_int 0))
(parallel [(set (reg:CC REG_CC)
(compare:CC (match_dup 0)
(const_int -1)))
- (clobber (match_operand:QI 1 "scratch_or_d_register_operand"))])
+ (clobber (match_operand:QI 1 "scratch_or_dreg_operand"))])
(set (pc)
(if_then_else (eqne (reg:CC REG_CC)
(const_int 0))