[Bug target/40697] inefficient code to extract least bits from an integer value

ramana at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Jul 9 10:32:00 GMT 2009



------- Comment #3 from ramana at gcc dot gnu dot org  2009-07-09 10:32 -------
(In reply to comment #2)
> Maybe we can fix this in expand instead: if we see (x & CONST) and CONST is a
> masking constant that isn't a legitimate constant for the the target, then see
> if the sum of the rtx_cost of expressing the mask as shifts is less than the
> rtx_cost of a load and an AND.
> 
> I think (but I'm not sure...) that if you do this with a peephole, you're too
> late to avoid the constant pool.

A peephole2 will do the trick . Constant pools in the ARM port are generated
and placed as a part of the reorg pass.


> 
> Is this also a size issue?

Indeed - instead of 6 bytes (2 bytes for the ldr and 4 bytes for the .word
which ends up in the .text section anyway.) instructions and you save a memory
access. 



> 


-- 


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



More information about the Gcc-bugs mailing list