[llvm] [AMDGPU] Fix VOP3P NEG fold to check the use opcode, not the def (PR #219728)
Arseniy Obolenskiy via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 15 04:04:24 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:
----------------
aobolensk wrote:
Not applicable anymore, removed this code
https://github.com/llvm/llvm-project/pull/219728
More information about the llvm-commits
mailing list