[Bug target/67288] [5/6/7 regression] non optimal simple function (useless additional shift/remove/shift/add)
segher at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jan 31 00:06:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67288
--- Comment #6 from Segher Boessenkool <segher at gcc dot gnu.org> ---
(In reply to Bernd Schmidt from comment #5)
> (In reply to Christophe Leroy from comment #0)
>
> > The following section is just useless: (shift left 4 bits, remove 16, shift
> > right 4 bits, add 1)
> > c000d984: 55 24 20 36 rlwinm r4,r9,4,0,27
> > c000d988: 39 24 ff f0 addi r9,r4,-16
> > c000d98c: 55 29 e1 3e rlwinm r9,r9,28,4,31
> > c000d990: 39 29 00 01 addi r9,r9,1
>
> Are you suggesting just removing these? That would not produce the same
> value in all cases - consider zero as an input:
>
> ((0 << 4) - 16) >> 4 = 0xfffffff, add one and you get 0x10000000.
But this cannot happen, see the two immediately preceding instructions.
More information about the Gcc-bugs
mailing list