[PATCH] D127679: [RISCV] Implement RISCVTargetLowering::getTargetConstantFromLoad.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 13 12:31:21 PDT 2022
craig.topper added inline comments.
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:9393
+
+ switch (Ptr.getMachineOpcode()) {
+ default:
----------------
reames wrote:
> I may be missing the obvious here, but... if we peak back through an add to find the constant pool entry, don't we need to account for the offset when processing the constant?
>
> (e.g. if the constant is 8 bytes, but the addi offset was 4, aren't we only loading 4 out of the bytes not the whole constant?)
The constant pool operand is in the immediate operand of the ADDI. The register source should be an LUI pointing to the same constant pool. So there is no offset in the ADDI itself. I do check the offset in the constant pool reference below.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127679/new/
https://reviews.llvm.org/D127679
More information about the llvm-commits
mailing list