[PATCH] D147916: [10/11][POC][Clang][RISCV] Define vget for tuple type

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 18 18:31:34 PDT 2023


craig.topper added inline comments.


================
Comment at: clang/include/clang/Basic/riscv_vector.td:2599
+          llvm::Value *IndexOperand = Ops[1];
+          assert(isa<ConstantInt>(IndexOperand));
+          unsigned Index = cast<ConstantInt>(IndexOperand)->getZExtValue();
----------------
You can drop this assert. `cast` already has the same assert.


================
Comment at: clang/include/clang/Basic/riscv_vector.td:2602
+          unsigned MaxIndex = cast<StructType>(VTupleOperand->getType())->getNumElements();
+          Index = std::min(Index, MaxIndex);
+
----------------
Does this `min` do anything or does SemaChecking already guarantee it?


================
Comment at: clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vget_tuple.c:18
+//
+vint32m1_t test_vget_v_i32m1x2_i32m1(vint32m1x2_t src, size_t index) {
+  return __riscv_vget_v_i32m1x2_i32m1(src, 0);
----------------
`index` argument is unused


================
Comment at: clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vget-index-out-of-range.c:343
+
+vint32m1_t test_vget_v_i32m1x2_i32m1(vint32m1x2_t src, size_t index) {
+  // expected-error at +1 {{argument value 2 is outside the valid range [0, 1]}}
----------------
`index` argument is unused


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147916



More information about the cfe-commits mailing list