avr: optimizing assignment to a bit field
Shaun Jackman
sjackman@gmail.com
Sun Nov 29 01:08:00 GMT 2009
2009/11/28 Richard Guenther <richard.guenther@gmail.com>:
> On Sat, Nov 28, 2009 at 11:43 PM, Shaun Jackman <sjackman@gmail.com> wrote:
>> When assigning a bool to a single bit of a bitfield located in the
>> bit-addressable region of memory, better code is produced by
>> if (flag)
>> bitfield.bit = true;
>> else
>> bitfield.bit = false;
>> than
>> bitfield.bit = flag;
>>
>> I've included a short test and the assembler output by both forms.
>> Should I file a bug suggesting a possible improvement here?
>
> Yes, a bugreport is useful - but there might be a bug with this issue
> already.
Reported here:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42210
Cheers,
Shaun
More information about the Gcc
mailing list