[all-commits] [llvm/llvm-project] 5a9861: [AMDGPU] Make custom AsmParser matchers alignment ...

Valery Pykhtin via All-commits all-commits at lists.llvm.org
Tue Sep 8 14:16:42 PDT 2026


  Branch: refs/heads/users/vpykhtin/amdgpu-asmparser-matchers-align-aware
  Home:   https://github.com/llvm/llvm-project
  Commit: 5a9861efa39245799fd11a376382e35facbb12dc
      https://github.com/llvm/llvm-project/commit/5a9861efa39245799fd11a376382e35facbb12dc
  Author: Valery Pykhtin <valery.pykhtin at amd.com>
  Date:   2026-09-08 (Tue, 08 Sep 2026)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
    M llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
    M llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
    M llvm/test/MC/AMDGPU/gfx1250_asm_vopd_errs.s
    M llvm/test/MC/AMDGPU/misaligned-vgpr-tuples-err.s

  Log Message:
  -----------
  [AMDGPU] Make custom AsmParser matchers alignment aware

Currently custom matchers accept registers belonging to unaligned classes,
leaving the alignment check and its diagnostic to validateVGPRAlign. The problem
is that validateVGPRAlign does not account for the operand register class, which
may have a different alignment requirement on mixed-alignment targets.

The fix is to make a custom matcher resolve the operand's _AlignTarget class via
HwMode and use that resolved class to accept a register. However, doing so alone
would reject a misaligned register with a generic "invalid operand for
instruction" diagnostic, so extra infrastructure conveys the alignment diagnostic
instead: on a class miss, diagnoseRegAlign re-checks the register against the same
class with alignment relaxed (getUnalignedEquivalentRC, new in AMDGPUBaseInfo);
if it fits, the only problem is alignment, so it records
OperandMatchError::VGPRAlignMismatch on the operand. matchAndEmitInstruction
selects that reason and prints the alignment error, now at the offending operand
column instead of column 1.

This commit converts the input-mods and DP-ALU DPP matchers. The no-modifier
reg-or-inline operands come next. validateVGPRAlign stays as a catch-all until
every operand is converted.

Co-Authored-By: Claude <noreply at anthropic.com>


  Commit: cbc1384851a20f23aa3ab5b0e00f4e40fb013af7
      https://github.com/llvm/llvm-project/commit/cbc1384851a20f23aa3ab5b0e00f4e40fb013af7
  Author: Valery Pykhtin <valery.pykhtin at amd.com>
  Date:   2026-09-08 (Tue, 08 Sep 2026)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
    M llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
    M llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
    M llvm/test/MC/AMDGPU/gfx1250_asm_vopd_errs.s
    M llvm/test/MC/AMDGPU/misaligned-vgpr-tuples-err.s

  Log Message:
  -----------
  [AMDGPU] Drop the misaligned VGPR-tuple AsmParser diagnostic

The alignment-aware matchers already reject a misaligned tuple, so a
misaligned operand now fails as a plain invalid operand. Keeping the
dedicated "vgpr tuples must be 64 bit aligned" message only for that
case is not worth the extra match-error ranking, the per-operand
diagnostic, and getUnalignedEquivalentRC, so remove all of it.


Compare: https://github.com/llvm/llvm-project/compare/a2fbab7d1727...cbc1384851a2

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list