[llvm] [RISCV][GISEL] Add legalizer for G_BSWAP (PR #70226)

Michael Maitland via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 11:41:31 PDT 2023


================
@@ -81,6 +81,11 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST) {
         .clampScalar(BigTyIdx, XLenLLT, XLenLLT);
   }
 
+  getActionDefinitionsBuilder(G_BSWAP)
+    .widenScalarToNextPow2(0)
----------------
michaelmaitland wrote:

widenScalarToNextPow2 I grabbed from AArch64 who does not seem to be testing it as well. I agree that we can drop it because the intrinsic documentation says it will always be a power of 2. The clampScalar I think is needed in the case that there is a bswap.i64 on rv32? The last commit shows the impact on the diff. Do you think it was correct before the last commit?

https://github.com/llvm/llvm-project/pull/70226


More information about the llvm-commits mailing list