[llvm] [NVPTX] Add truncate and zero-extend free type conversions (PR #125580)

Baodi Shan via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 4 07:13:22 PST 2025


================
@@ -150,6 +150,28 @@ class NVPTXTargetLowering : public TargetLowering {
            DstTy->getPrimitiveSizeInBits() == 32;
   }
 
+  bool isTruncateFree(EVT SrcVT, EVT DstVT) const override {
+    // Truncating from i64 to i32 is free
+    if (SrcVT.isInteger() && DstVT.isInteger())
+      return SrcVT.getSizeInBits() == 64 && DstVT.getSizeInBits() == 32;
+    return false;
----------------
lwshanbd wrote:

Why does it need to return false when both are isInteger?

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


More information about the llvm-commits mailing list