[PATCH] D123290: [LoongArch] Add support for selecting constant materializations.
Ray Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 7 19:06:51 PDT 2022
wangleiat added inline comments.
================
Comment at: llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMatInt.cpp:23
+ //
+ int64_t Highest12 = Val >> 52 & 0xFFF;
+ int64_t Higher20 = Val >> 32 & 0xFFFFF;
----------------
MaskRay wrote:
> Add const if applicable
Thanks, I will add it.
================
Comment at: llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMatInt.cpp:44
+
+ if (SignExtend32<1>(Hi20 >> 19) != SignExtend32<20>(Higher20))
+ Insts.push_back(Inst(LoongArch::LU32I_D, SignExtend64<20>(Higher20)));
----------------
MaskRay wrote:
> The logic looks weird. What does it do?
It is to check whether `Higher20` is equal to the repetition of the 31st bit.
This judgment is made because these `LU12I_W` `ADDI_W` instructions will writes `imm` into the general register after `sign extension`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123290/new/
https://reviews.llvm.org/D123290
More information about the llvm-commits
mailing list