[PATCH] D152236: [RISCV] Add special case to selectImm for constants that can be created with (ADD (SLLI C, 32), C).
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 6 09:53:08 PDT 2023
craig.topper added inline comments.
================
Comment at: llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp:225
+ 0);
+ return SDValue(CurDAG->getMachineNode(RISCV::ADDI, DL, VT, Lo, SLLI),
+ 0);
----------------
reames wrote:
> If you swap these operands, does that help add immediate formation when the two halves are very small?
>
> I'm thinking of the case 0x00020002. This can be done as LI + SHL + ADDI. With only a single register.
>
> This might not matter, and we might need a second special case for this, if so, feel free to punt to future patch.
>
> Thinking about, it's probably a subcase of having a general 32 bit constant hi, + a 12 bit low half which can always be done in 4 instructions, and 3 depending on the exact details of the high half.
This should be ADD not ADDI.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152236/new/
https://reviews.llvm.org/D152236
More information about the llvm-commits
mailing list