[llvm] [NVPTX] designate fabs and fneg as free (PR #121513)

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 7 16:47:38 PST 2025


================
@@ -261,6 +261,9 @@ class NVPTXTargetLowering : public TargetLowering {
     return true;
   }
 
+  bool isFAbsFree(EVT VT) const override { return true; }
+  bool isFNegFree(EVT VT) const override { return true; }
----------------
AlexMaclean wrote:

Yea, you make some good points. The main reason I think this is worth doing is that in many cases abs and neg are essentially free due to ptxas optimizations (here is a slightly larger example highlighting this: https://cuda.godbolt.org/z/86G9E6fMd). 

In any case, thanks for the flexibility on this one. I'll go ahead and merge.  

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


More information about the llvm-commits mailing list