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



Mikael Pettersson <mikpe at it dot uu.se> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

                 CC|                            |mikpe at it dot uu.se



--- Comment #4 from Mikael Pettersson <mikpe at it dot uu.se> 2012-10-29 
22:18:16 UTC ---

(In reply to comment #3)

> I've checked this issue again on rev 192482.  It seems to be target

> independent, as it also happens on ARM.

> The following:

> 

> static inline int readint (int* x)

> {

>   return *x;

> }

> 

> int test (int* x)

> {

>   return readint (x);

> }

> 

> compiles to (-O2):

> 

> test:

>         ldrb    r3, [r0]

>     ldrb    r1, [r0, #1]

>     ldrb    r2, [r0, #2]

>     orr    r3, r3, r1, asl #8

>     ldrb    r0, [r0, #3]

>     orr    r3, r3, r2, asl #16

>     orr    r0, r3, r0, asl #24

>     bx    lr



I see this poor code too on armv5tel-linux-gnueabi with 4.8-20121028.

4.7 and 4.6 generate just two instructions for test: a ldr and bx.

Reply via email to