[PATCH] D142636: AMDGPU/MC: Refactor decoders. Rework decoders for float immediates

Petar Avramovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 26 07:56:30 PST 2023


Petar.Avramovic created this revision.
Petar.Avramovic added reviewers: piotr, Joe_Nash, dp, rovka, AMDGPU.
Herald added subscribers: kosarev, foad, kerbowa, hiraditya, tpr, dstuttard, yaxunl, jvesely, kzhuravl, arsenm.
Herald added a project: All.
Petar.Avramovic requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

decodeFPImmed creates immediate operand using register operand width,
but size of created immediate should correspond to OperandType for
RegisterOperand.
e.g. OPW128 could be used for RegisterOperands that use v2f64 v4f32
and v8f16. Each RegisterOperands would have different OperandType and
require that immediate is decoded using 64, 32 and 16 bit immediate
respectively.
decodeOperand_<RegClass> only provides width for register decoding,
introduce decodeOperand_<RegClass>_Imm<ImmWidth> that also provides
width for immediate decoding.
Refactor RegisterOperands:

- decoders get _Imm<ImmWidth> suffix in some cases
- removed unused RegisterOperands defined via multiclass
- use different RegisterOperand in a few places, new RegisterOperand's decoder corresponds to the number of bits used for operand's encoding

Refactor decoder functions:

- add asserts for the size of encoding that will be decoded
- regroup them according to the method of decoding

decodeOperand_<RegClass> (register only, no immediate) decoders can now
create immediate of consistent size, use it for better diagnostic of
'invalid immediate'.


https://reviews.llvm.org/D142636

Files:
  llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
  llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.h
  llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.cpp
  llvm/lib/Target/AMDGPU/SIInstrInfo.td
  llvm/lib/Target/AMDGPU/SIRegisterInfo.td
  llvm/lib/Target/AMDGPU/VOP1Instructions.td
  llvm/lib/Target/AMDGPU/VOP2Instructions.td
  llvm/lib/Target/AMDGPU/VOP3PInstructions.td
  llvm/lib/Target/AMDGPU/VOPCInstructions.td
  llvm/test/MC/Disassembler/AMDGPU/decode-err.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142636.492450.patch
Type: text/x-patch
Size: 55270 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230126/c24c0829/attachment.bin>


More information about the llvm-commits mailing list