This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/67288] [5/6/7 regression] non optimal simple function (useless additional shift/remove/shift/add)
- From: "segher at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 31 Jan 2017 00:06:06 +0000
- Subject: [Bug target/67288] [5/6/7 regression] non optimal simple function (useless additional shift/remove/shift/add)
- Auto-submitted: auto-generated
- References: <bug-67288-4@http.gcc.gnu.org/bugzilla/>
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.