[all-commits] [llvm/llvm-project] 407b61: [LoongArch] Add support for selecting constant mat...
wangleiat via All-commits
all-commits at lists.llvm.org
Thu Apr 14 21:09:03 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 407b613d7344a37662a9933d5684dd207917e577
https://github.com/llvm/llvm-project/commit/407b613d7344a37662a9933d5684dd207917e577
Author: wanglei <wanglei at loongson.cn>
Date: 2022-04-15 (Fri, 15 Apr 2022)
Changed paths:
M llvm/lib/Target/LoongArch/LoongArchISelDAGToDAG.cpp
M llvm/lib/Target/LoongArch/MCTargetDesc/CMakeLists.txt
A llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMatInt.cpp
A llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMatInt.h
A llvm/test/CodeGen/LoongArch/imm.ll
Log Message:
-----------
[LoongArch] Add support for selecting constant materializations.
Integer materializing can generate LU12I_W, ORI, LU32I_D, LU52I_D and
ADDI_W instructions.
According to the sign-extended behavior of these instructions
(except ORI), the generated instruction sequence can be improved.
For example, load -1 into general register:
The ADDI_W instruction performs the operation that the [31:0] bit data
in the general register `rj` plus the 12-bit immediate `simm12` sign
extension 32-bit data; the resultant [31:0] bit is sign extension, then
written into the general register `rd`.
Normal sequence:
```
lu12i.w $a0, -1
ori $a0, $a0, 2048
```
Improved with sign-extended instruction:
```
addi.w $a0, $zero, -1
```
Reviewed By: SixWeining, MaskRay
Differential Revision: https://reviews.llvm.org/D123290
More information about the All-commits
mailing list