[PATCH] D157603: [RISCV] zextOrTrunc constants to EltSize when combine store of BUILD_VECTOR
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 10 22:38:46 PDT 2023
craig.topper added inline comments.
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:13486
continue;
- NewC.insertBits(Val.getConstantOperandAPInt(i),
- i * Val.getScalarValueSizeInBits());
+ NewC.insertBits(Val.getConstantOperandAPInt(i).zextOrTrunc(EleSize),
+ i * EleSize);
----------------
wangpc wrote:
> craig.topper wrote:
> > Why does it need to be `zextOrTrunc`? Can it just be `trunc`? It never need to be extended right?
> Actually I don't know, here is just defensive programming.
I would use trunc so we get the assertion. If we did need to extend for some reason, I don't know that zero extend would be correct.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157603/new/
https://reviews.llvm.org/D157603
More information about the llvm-commits
mailing list