[PATCH] D120545: [LoongArch] Add EncoderMethod to unusual' immediate operand

Lu Weining via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 25 01:24:19 PST 2022


SixWeining created this revision.
SixWeining added reviewers: myhsu, xen0n, rengolin, MaskRay.
Herald added a subscriber: hiraditya.
SixWeining requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This is a split patch of D120476 <https://reviews.llvm.org/D120476> and thanks to myhsu.

The `unusual` means the encoding of an immediate is not the same as
its binary representation. For example, the `bl` instruction
requires a signed 28-bits integer as its operand and the low 2-bits
must be 0.

Based on the above reason this kind of immediate needs a customed
`EncoderMethod` to get the real immediate getting encoded into the
instruction.

Currently these immediate includes:

  uimm2_plus1
  simm14_lsl2
  simm16_lsl2
  simm21_lsl2
  simm26_lsl2

This patch adds those `EncoderMethod` and revises related .mir test
in previous patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120545

Files:
  llvm/lib/Target/LoongArch/LoongArchInstrInfo.td
  llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCCodeEmitter.cpp
  llvm/test/CodeGen/LoongArch/1ri.mir
  llvm/test/CodeGen/LoongArch/2ri.mir
  llvm/test/CodeGen/LoongArch/3ri.mir
  llvm/test/CodeGen/LoongArch/misc.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120545.411345.patch
Type: text/x-patch
Size: 10269 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220225/a0338dcd/attachment.bin>


More information about the llvm-commits mailing list