Commit 31fd727b by Georg-Johann Lay Committed by Georg-Johann Lay

avr.md (peephole casesi+2): Use -1 instead of 65536.


	* config/avr/avr.md (peephole casesi+2): Use -1 instead of 65536.
	* config/avr/avr.c (avr_out_compare): Print shorter sequence for
	EQ/NE comparisons against +/-1 in the case of unused-after,
	non-ld-regs target.

From-SVN: r179206
parent 21860814
2011-09-26 Georg-Johann Lay <avr@gjlay.de>
* config/avr/avr.md (peephole casesi+2): Use -1 instead of 65536.
* config/avr/avr.c (avr_out_compare): Print shorter sequence for
EQ/NE comparisons against +/-1 in the case of unused-after,
non-ld-regs target.
2011-09-26 Jakub Jelinek <jakub@redhat.com>
* gimple-fold.c (gimplify_and_update_call_from_tree): Set
......@@ -3048,6 +3048,37 @@ avr_out_compare (rtx insn, rtx *xop, int *plen)
if (plen)
*plen = 0;
/* Comparisons == +/-1 and != +/-1 can be done similar to camparing
against 0 by ORing the bytes. This is one instruction shorter. */
if (!test_hard_reg_class (LD_REGS, xreg)
&& compare_eq_p (insn)
&& reg_unused_after (insn, xreg))
{
if (xval == const1_rtx)
{
avr_asm_len ("dec %A0" CR_TAB
"or %A0,%B0", xop, plen, 2);
if (n_bytes == 4)
avr_asm_len ("or %A0,%C0" CR_TAB
"or %A0,%D0", xop, plen, 2);
return "";
}
else if (xval == constm1_rtx)
{
if (n_bytes == 4)
avr_asm_len ("and %A0,%D0" CR_TAB
"and %A0,%C0", xop, plen, 2);
avr_asm_len ("and %A0,%B0" CR_TAB
"com %A0", xop, plen, 2);
return "";
}
}
for (i = 0; i < n_bytes; i++)
{
/* We compare byte-wise. */
......
......@@ -4119,7 +4119,7 @@
(parallel
[(set (cc0)
(compare (match_dup 0)
(const_int 65535)))
(const_int -1)))
(clobber (match_operand:QI 1 "d_register_operand" ""))])
(set (pc)
(if_then_else (ne (cc0) (const_int 0))
......
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