Skip to content

Commit 3025907

Browse files
authored
[AMDGPU][True16][MC] fix opsel for v_cmpx 16bit inst (#135441)
Fixed inst printer so that no opsel is generated for dst reg of cmpx 16bit insts
1 parent 8c04656 commit 3025907

8 files changed

+403
-400
lines changed

llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,10 @@ void AMDGPUInstPrinter::printPackedModifier(const MCInst *MI,
12201220
(ModIdx != -1) ? MI->getOperand(ModIdx).getImm() : DefaultValue;
12211221
}
12221222

1223+
const bool HasDst =
1224+
(AMDGPU::getNamedOperandIdx(Opc, AMDGPU::OpName::vdst) != -1) ||
1225+
(AMDGPU::getNamedOperandIdx(Opc, AMDGPU::OpName::sdst) != -1);
1226+
12231227
// Print three values of neg/opsel for wmma instructions (prints 0 when there
12241228
// is no src_modifier operand instead of not printing anything).
12251229
if (MII.get(MI->getOpcode()).TSFlags & SIInstrFlags::IsSWMMAC ||
@@ -1238,9 +1242,8 @@ void AMDGPUInstPrinter::printPackedModifier(const MCInst *MI,
12381242
}
12391243

12401244
const bool HasDstSel =
1241-
NumOps > 0 &&
1242-
Mod == SISrcMods::OP_SEL_0 &&
1243-
MII.get(MI->getOpcode()).TSFlags & SIInstrFlags::VOP3_OPSEL;
1245+
HasDst && NumOps > 0 && Mod == SISrcMods::OP_SEL_0 &&
1246+
MII.get(MI->getOpcode()).TSFlags & SIInstrFlags::VOP3_OPSEL;
12441247

12451248
const bool IsPacked =
12461249
MII.get(MI->getOpcode()).TSFlags & SIInstrFlags::IsPacked;

llvm/test/MC/AMDGPU/gfx11_asm_vop3_from_vopcx.s

+59-59
Large diffs are not rendered by default.

llvm/test/MC/AMDGPU/gfx11_asm_vopcx_t16_promote.s

+60-60
Large diffs are not rendered by default.

llvm/test/MC/AMDGPU/gfx12_asm_vop3cx.s

+55-55
Large diffs are not rendered by default.

llvm/test/MC/AMDGPU/gfx12_asm_vopcx_t16_promote.s

+54-54
Large diffs are not rendered by default.

llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_vop3_from_vopcx.txt

+59-59
Large diffs are not rendered by default.

llvm/test/MC/Disassembler/AMDGPU/gfx12_dasm_vop3cx.txt

+55-55
Large diffs are not rendered by default.

llvm/test/MC/Disassembler/AMDGPU/gfx12_dasm_vop3cx_dpp16.txt

+55-55
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)