[PATCH] D157603: [RISCV] zextOrTrunc constants to EleSize when combine store of BUILD_VECTOR

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 22:14:05 PDT 2023


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:13482
       APInt NewC(Val.getValueSizeInBits(), 0);
+      uint64_t EleSize = Val.getScalarValueSizeInBits();
       for (unsigned i = 0; i < Val.getNumOperands(); i++) {
----------------
Ele -> Elt


================
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);
----------------
Why does it need to be `zextOrTrunc`? Can it just be `trunc`? It never need to be extended right?


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