[AMDGPU] Fix opcode comparison logic for G_INTRINSIC (#156008)

The check `(Opc < TargetOpcode::GENERIC_OP_END)` incorrectly
includes `G_INTRINSIC` (129), which is less than
`GENERIC_OP_END` (313), leading to logically dead code.

This patch reorders the conditionals to first check for `G_INTRINSIC`,
ensuring
correct handling of the `amdgcn_fdot2` intrinsic.
This commit is contained in:
Piotr Balcer 2026-02-18 12:05:36 +01:00 committed by GitHub
parent e6cff75362
commit 6012aa1d44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4990,14 +4990,14 @@ public:
const MachineInstr *MI = MRI.getVRegDef(Reg);
unsigned Opc = MI->getOpcode();
if (Opc < TargetOpcode::GENERIC_OP_END) {
// Keep same for generic op.
HasNeg = true;
} else if (Opc == TargetOpcode::G_INTRINSIC) {
if (Opc == TargetOpcode::G_INTRINSIC) {
Intrinsic::ID IntrinsicID = cast<GIntrinsic>(*MI).getIntrinsicID();
// Only float point intrinsic has neg & neg_hi bits.
if (IntrinsicID == Intrinsic::amdgcn_fdot2)
HasNeg = true;
} else if (TargetInstrInfo::isGenericOpcode(Opc)) {
// Keep same for generic op.
HasNeg = true;
}
}
bool checkOptions(SrcStatus Stat) const {