[llvm] [NVPTX] Implement isTruncateFree and isZExtFree for i32/i64 Optimizations (PR #114683)

Justin Fargnoli via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 10:46:38 PST 2024


================
@@ -3340,6 +3340,23 @@ bool NVPTXTargetLowering::splitValueIntoRegisterParts(
   return false;
 }
 
+bool llvm::NVPTXTargetLowering::isTruncateFree(EVT FromVT, EVT ToVT) const {
+  if (FromVT.isVector() || ToVT.isVector() || !FromVT.isInteger() ||
+      !ToVT.isInteger()) {
+    return false;
+  }
+
+  return FromVT.getSizeInBits() == 64 && ToVT.getSizeInBits() == 32;
+}
+
+bool llvm::NVPTXTargetLowering::isZExtFree(EVT FromVT, EVT ToVT) const {
+  return false;
+}
+
+bool llvm::NVPTXTargetLowering::isZExtFree(Type *SrcTy, Type *DstTy) const {
+  return false;
+}
+
----------------
justinfargnoli wrote:

First, let's move the implementation of these functions to `NVPTXISelLowering.h`. They are small enough that it should be okay, and it's the existing convention. 

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


More information about the llvm-commits mailing list