[Patch,AVR]: Fix cc0 and loading const_int/const_double
Denis Chertykov
chertykov@gmail.com
Mon Nov 21 18:39:00 GMT 2011
2011/11/21 Georg-Johann Lay <avr@gjlay.de>:
> After updating my local copy I get new runtime FAILs in the test suite because
> of the following sequence, e.g. from gcc.c-torture/execute/990527-1.c:
>
> sbiw r28,1 ; 12 addhi3_clobber/1 [length = 1]
> ldi r24,lo8(9) ; 24 *movhi/5 [length = 2]
> clr r25
> brne .L3 ; 16 branch [length = 1]
>
> The trouble is that *movhi promises that it does not change cc0. Thus, the
> correct code is:
>
> sbiw r28,1 ; 12 addhi3_clobber/1 [length = 1]
> ldi r24,lo8(9) ; 24 *movhi/5 [length = 2]
> ldi r25,0
> brne .L3 ; 16 branch [length = 1]
>
> The patch fixes this and adjusts cc attribute of involved insns.
>
> When loading 0, cc=none is more useful than cc=set_zn because the compiler
> knows what it loads, and cc=none preserves cc0 from preceding code.
>
> Tests pass fine again.
>
> Ok to apply?
>
> Johann
>
> * config/avr/avr.c (output_reload_in_const): Loading a byte with 0
> must not affect cc0.
> * config/avr/avr.md (*movhi, *movpsi, *movsi, *movsf): Zero to any
> register does not change cc0. Same for any constant to ld-register.
>
>
Approved.
Denis.
More information about the Gcc-patches
mailing list