[llvm] [NVPTX] Use PRMT instruction to lower i16 bswap (PR #168968)

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 21 15:03:25 PST 2025


================
@@ -1106,6 +1104,12 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
   //   * MVT::Other - internal.addrspace.wrap
   setOperationAction(ISD::INTRINSIC_WO_CHAIN,
                      {MVT::i32, MVT::i128, MVT::v4f32, MVT::Other}, Custom);
+
+  // Custom lowering for bswap
+  setOperationAction(ISD::BSWAP, MVT::i16, Custom);
+  setOperationAction(ISD::BSWAP, MVT::i32, Custom);
+  setOperationAction(ISD::BSWAP, MVT::i64, Custom);
+  setOperationAction(ISD::BSWAP, MVT::v2i16, Custom);
----------------
AlexMaclean wrote:

Nit: use the ArrayRef version of this (see the line above for an example).

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


More information about the llvm-commits mailing list