[llvm] 560292f - [AMDGPU] Update isFMAFasterThanFMulAndFAdd assumptions
Carl Ritson via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 6 23:42:33 PDT 2020
Author: Carl Ritson
Date: 2020-07-07T15:40:44+09:00
New Revision: 560292fa990a2bfcf8415f07a166393beff667f6
URL: https://github.com/llvm/llvm-project/commit/560292fa990a2bfcf8415f07a166393beff667f6
DIFF: https://github.com/llvm/llvm-project/commit/560292fa990a2bfcf8415f07a166393beff667f6.diff
LOG: [AMDGPU] Update isFMAFasterThanFMulAndFAdd assumptions
MAD/MAC is no longer always available.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D83207
Added:
Modified:
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index d90272848500..79204180540f 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -4277,10 +4277,13 @@ bool SITargetLowering::isFMAFasterThanFMulAndFAdd(const MachineFunction &MF,
switch (VT.getSimpleVT().SimpleTy) {
case MVT::f32: {
- // This is as fast on some subtargets. However, we always have full rate f32
- // mad available which returns the same result as the separate operations
- // which we should prefer over fma. We can't use this if we want to support
- // denormals, so only report this in these cases.
+ // If mad is not available this depends only on if f32 fma is full rate.
+ if (!Subtarget->hasMadMacF32Insts())
+ return Subtarget->hasFastFMAF32();
+
+ // Otherwise f32 mad is always full rate and returns the same result as
+ // the separate operations so should be preferred over fma.
+ // However does not support denomals.
if (hasFP32Denormals(MF))
return Subtarget->hasFastFMAF32() || Subtarget->hasDLInsts();
More information about the llvm-commits
mailing list