This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch,AVR]: Fix PR49939: Skip 2-word insns


Denis Chertykov schrieb:
> 2011/10/11 Georg-Johann Lay <avr@gjlay.de>:
>> This patch teaches avr-gcc to skip 2-word instructions like STS and LDS.
>>
>> It's just about looking into an 2-word insn and check if it's a 2-word
>> instruction or not.
>>
>> Passes without regression. Ok to install?
> 
> Please commit.
> 
> Denis.

Committed with the following change:

-              && avr_2word_insn_p (next_nonnote_nondebug_insn (insn))));
+              && avr_2word_insn_p (next_active_insn (insn))));

Otherwise a code label would knock out the optimization like in


char c;

void foo (char a, char b)
{
    if (a || b)
        c = b;
}

which now compiles to

foo:
	tst r24
	brne .L4
	cpse r22,__zero_reg__
.L4:
	sts c,r22
.L3:
	ret

Johann


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]