https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78543
Michael Meissner <meissner at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|bergner at gcc dot gnu.org |meissner at gcc dot
gnu.org
--- Comment #17 from Michael Meissner <meissner at gcc dot gnu.org> ---
While Peter is away, I looked into this.
The bug happens when the RELOAD register allocator tries to do a bswap
operation. I believe in the original test case, the compiler identifies the
case as something that could be optimized to __builtin_bswap16. In the second
case, the code has an explicit __builtin_bswap32 call.
This bug shows up on little endian systems and not on big endian systems. This
is due to the bswap instruction being called with a SUBREG. Reload gets
confused with this, and LRA decides to do a store, so that it can then do a
LWBRX instruction.
If we copy the SUBREG to a new register, it works for the second case provided.
I can't get the first case to fail.