[Bug target/33049] [avr] bit extraction non optimal, inversing logic solves problem

gjl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon May 30 14:48:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33049

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gjl at gcc dot gnu.org

--- Comment #14 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-05-30 14:33:31 UTC ---
(In reply to comment #13)
> Yep it looks a lot better now.
> The if statements could be optimized into the equivalent shift instructions but
> that is not a AVR backend problem I guess.

Shifting generally is more expensive instead of bit extracting; at least if the
bit offset is known at compile time.

> I noticed that the disassembly shows wrong lengths for some outputs of extzv.
> Is that a problem?

It's not a problem if the sequence actually printed is not greater than the
instruction length reported. If the reported instruction length was strinct
greater, an assembler error could occur because relative jump offets migh be
out of scope.

The only case where the instruction length is smaller than reported is if
IN_REG=OUT_REG and BITPOS=4 (sequence is swap + andi 1). The instruction length
for lsr + andi 1 (IN_REG=OUT_REG, BITPOS=1) is already corrected in the patch.



More information about the Gcc-bugs mailing list