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

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 7 14:26:40 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:

The SASS emitted will be dependent on lots of decisions in `ptxas` and I'm not able to say anything definitive or non-public about how PTX instructions will be emitted in SASS.  However, here is a simple compiler explorer program which shows a case where these instructions appear to be free in terms of SASS instruction count: https://cuda.godbolt.org/z/MGeb71jjz

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


More information about the llvm-commits mailing list