[llvm] [AMDGPU] Fix VOP3P NEG fold to check the use opcode, not the def (PR #219728)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 06:12:03 PDT 2026
================
@@ -5163,9 +5164,34 @@ calcNextStatus(std::pair<Register, SrcStatus> Curr,
return std::nullopt;
}
-/// This is used to control valid status that current MI supports. For example,
-/// non floating point intrinsic such as @llvm.amdgcn.sdot2 does not support NEG
-/// bit on VOP3P.
+/// Packed integer VOP3P opcodes ignore NEG/NEG_HI, so folding a G_FNEG into
+/// them would silently drop the negation.
+static bool usesFPSrcMods(const MachineInstr &MI) {
+ unsigned Opc = MI.getOpcode();
+ if (isPreISelGenericFloatingPointOpcode(Opc))
+ return true;
+
+ // To re-audit, collect the direct parent of each "(VOP3PMods" in
+ // AMDGPUGenGlobalISel.inc.
+ switch (Opc) {
+ case AMDGPU::G_AMDGPU_CLAMP:
+ case AMDGPU::G_AMDGPU_FMIN3:
+ case AMDGPU::G_AMDGPU_FMAX3:
+ case AMDGPU::G_AMDGPU_FMINIMUM3:
+ case AMDGPU::G_AMDGPU_FMAXIMUM3:
----------------
arsenm wrote:
These cases don't have any VOP3P packed instructions?
https://github.com/llvm/llvm-project/pull/219728
More information about the llvm-commits
mailing list