[llvm] [AMDGPU] Constant fold FMAD_FTZ (PR #69443)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 18 23:05:47 PDT 2023


================
@@ -5041,6 +5041,19 @@ SDValue AMDGPUTargetLowering::PerformDAGCombine(SDNode *N,
     return performAssertSZExtCombine(N, DCI);
   case ISD::INTRINSIC_WO_CHAIN:
     return performIntrinsicWOChainCombine(N, DCI);
+  case AMDGPUISD::FMAD_FTZ: {
+    SDValue N0 = N->getOperand(0);
+    SDValue N1 = N->getOperand(1);
+    SDValue N2 = N->getOperand(2);
+    EVT VT = N->getValueType(0);
+
+    // FMAD_FTZ is a FMAD, but flushing to zero is allowed (not required).
----------------
Pierre-vh wrote:

So we do a mul, flush denormals to zero, and then the add, and flush again? (Since FMAD is two separate rounding steps) or does the flush only happen at the end?
Do we have a helper somewhere to flush a denormal to zero?

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


More information about the llvm-commits mailing list