[all-commits] [llvm/llvm-project] c063f9: [LoongArch] Add EncoderMethods for transformed imm...

Lu Weining via All-commits all-commits at lists.llvm.org
Mon Mar 7 00:50:31 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c063f9da5519d7fb83873c04234ef12e33ba28c3
      https://github.com/llvm/llvm-project/commit/c063f9da5519d7fb83873c04234ef12e33ba28c3
  Author: Weining Lu <luweining at loongson.cn>
  Date:   2022-03-07 (Mon, 07 Mar 2022)

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

  Log Message:
  -----------
  [LoongArch] Add EncoderMethods for transformed immediate operands

This is a split patch of D120476 and thanks to myhsu.

'Transformed' 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. So only the upper 26 bits are needed to get encoded into
the instruction.

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

Currently these immediate includes:
```
  uimm2_plus1
  simm14_lsl2
  simm16_lsl2
  simm21_lsl2
  simm26_lsl2
```

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

Reviewed By: xen0n, MaskRay

Differential Revision: https://reviews.llvm.org/D120545




More information about the All-commits mailing list