[PowerPC] Combine 64-bit bswap(load) without LDBRX
authorNemanja Ivanovic <nemanja.i.ibm@gmail.com>
Thu, 24 Jun 2021 19:44:17 +0000 (14:44 -0500)
committerNemanja Ivanovic <nemanja.i.ibm@gmail.com>
Thu, 24 Jun 2021 20:11:47 +0000 (15:11 -0500)
commit0464586ac515e8cfebe4c7615387fd625c8869f5
treea8c5e5104d84c0970d37c331b0c1ebbe2eddf0c2
parent8e0ff44bf896733f04c5cc9e68aee2b777860ddd
[PowerPC] Combine 64-bit bswap(load) without LDBRX

When targeting CPUs that don't have LDBRX, we end up producing code that is
very inefficient and large for this common idiom. This patch just
optimizes it two 32-bit LWBRX instructions along with a merge.

This fixes https://bugs.llvm.org/show_bug.cgi?id=49610

Differential revision: https://reviews.llvm.org/D104836
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/test/CodeGen/PowerPC/bswap-load-store.ll
llvm/test/CodeGen/PowerPC/ld-bswap64-no-ldbrx.ll [new file with mode: 0644]