Skip to content

[AMDGPU][True16][MC] fix opsel for v_cmpx 16bit inst #135441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,10 @@ void AMDGPUInstPrinter::printPackedModifier(const MCInst *MI,
(ModIdx != -1) ? MI->getOperand(ModIdx).getImm() : DefaultValue;
}

const bool HasDst =
(AMDGPU::getNamedOperandIdx(Opc, AMDGPU::OpName::vdst) != -1) ||
(AMDGPU::getNamedOperandIdx(Opc, AMDGPU::OpName::sdst) != -1);
Comment on lines +1223 to +1225
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be slightly safer to just check that operand 0 is a def rather than relying on the operand names

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Matt are you referring to the isDef check for the machineoperand? This is used in asm/dasm for printing and I thought we don't have the context there to check if an operand is a def?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I don't think we have the use/def info at this point. LGTM


// Print three values of neg/opsel for wmma instructions (prints 0 when there
// is no src_modifier operand instead of not printing anything).
if (MII.get(MI->getOpcode()).TSFlags & SIInstrFlags::IsSWMMAC ||
Expand All @@ -1238,9 +1242,8 @@ void AMDGPUInstPrinter::printPackedModifier(const MCInst *MI,
}

const bool HasDstSel =
NumOps > 0 &&
Mod == SISrcMods::OP_SEL_0 &&
MII.get(MI->getOpcode()).TSFlags & SIInstrFlags::VOP3_OPSEL;
HasDst && NumOps > 0 && Mod == SISrcMods::OP_SEL_0 &&
MII.get(MI->getOpcode()).TSFlags & SIInstrFlags::VOP3_OPSEL;

const bool IsPacked =
MII.get(MI->getOpcode()).TSFlags & SIInstrFlags::IsPacked;
Expand Down
118 changes: 59 additions & 59 deletions llvm/test/MC/AMDGPU/gfx11_asm_vop3_from_vopcx.s

Large diffs are not rendered by default.

120 changes: 60 additions & 60 deletions llvm/test/MC/AMDGPU/gfx11_asm_vopcx_t16_promote.s

Large diffs are not rendered by default.

110 changes: 55 additions & 55 deletions llvm/test/MC/AMDGPU/gfx12_asm_vop3cx.s

Large diffs are not rendered by default.

108 changes: 54 additions & 54 deletions llvm/test/MC/AMDGPU/gfx12_asm_vopcx_t16_promote.s

Large diffs are not rendered by default.

118 changes: 59 additions & 59 deletions llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_vop3_from_vopcx.txt

Large diffs are not rendered by default.

110 changes: 55 additions & 55 deletions llvm/test/MC/Disassembler/AMDGPU/gfx12_dasm_vop3cx.txt

Large diffs are not rendered by default.

110 changes: 55 additions & 55 deletions llvm/test/MC/Disassembler/AMDGPU/gfx12_dasm_vop3cx_dpp16.txt

Large diffs are not rendered by default.