[PATCH] D103693: [RISCV] Add support for BUILD_VECTOR, VECTOR_SHUFFLE and INSERT_VECTOR_ELT for RVP

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 5 12:59:42 PDT 2021


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:1733
+    unsigned W = EltTy.getSizeInBits();
+    uint64_t Mask = (EltTy == MVT::i8)
+                        ? 0xff
----------------
Can this be done with getTrailingOnesMask from MathExtras.h


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:3543
+    return DAG.getNode(RISCVISD::INSERTB, DL, VecTy, {Vector, Value, Index});
+  else if (EltTy == MVT::i16)
+    return DAG.getNode(RISCVISD::INSERTH, DL, VecTy, {Vector, Value, Index});
----------------
No need for else since the if returned


================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoP.td:26
 
+def riscv_insertb : SDNode<"RISCVISD::INSERTB", SDT_RISCVVecInsert>;
+def riscv_inserth : SDNode<"RISCVISD::INSERTH", SDT_RISCVVecInsert>;
----------------
Do we really need 3 different RISCVISD opcodes or can we use one and determine the instruction from the element type in the isel pattern?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103693/new/

https://reviews.llvm.org/D103693



More information about the llvm-commits mailing list