[llvm] [NVPTX] Fix lowering of fabs and fneg (PR #219089)

Lewis Crawford via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 05:29:57 PDT 2026


================
@@ -1064,17 +1067,18 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
   setFP16OperationAction(ISD::FTANH, MVT::v2f16, Legal, Expand);
   setBF16OperationAction(ISD::FTANH, MVT::v2bf16, Legal, Expand);
 
-  setOperationAction(ISD::FABS, {MVT::f32, MVT::f64}, Legal);
+  // Lower fabs x to and x, 0x7f... to preserve NaN payloads
----------------
LewisCrawford wrote:

This comment isn't entirely accurate, since it can also translate it into PTX abs instructions wherever possible. Same with the above FNeg comment.

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


More information about the llvm-commits mailing list