[llvm] [AMDGPU] Improve DPP combining for fadd (PR #100148)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 23 09:19:32 PDT 2024
================
@@ -478,6 +478,16 @@ static bool isIdentityValue(unsigned OrigMIOp, MachineOperand *OldOpnd) {
if (OldOpnd->getImm() == 1)
return true;
break;
+ case AMDGPU::V_ADD_F32_e32:
+ case AMDGPU::V_ADD_F32_e64:
+ // -0.0 is an identity for fadd.
+ if (static_cast<uint32_t>(OldOpnd->getImm()) == 0x80000000)
+ return true;
+ // +0.0 is an identity for fadd except for the sign of a zero result.
+ if (MI.getFlag(MachineInstr::FmNsz) &&
+ static_cast<uint32_t>(OldOpnd->getImm()) == 0)
+ return true;
+ break;
----------------
arsenm wrote:
Should this handle the v2f16/f16 cases?
Can we handle fsub in a follow up too?
https://github.com/llvm/llvm-project/pull/100148
More information about the llvm-commits
mailing list