================
@@ -0,0 +1,99 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// RUN: %clang_cc1 -triple riscv32 -target-feature +v \
+// RUN: -disable-O0-optnone \
+// RUN:  -emit-llvm -o - %s | opt -S -passes=sroa | FileCheck %s \
+// RUN:  --check-prefixes=CHECK,CHECK32
+// RUN: %clang_cc1 -triple riscv64 -target-feature +v \
+// RUN: -disable-O0-optnone \
+// RUN:  -emit-llvm -o - %s | opt -S -passes=sroa | FileCheck %s \
+// RUN:  --check-prefixes=CHECK,CHECK64
+
+// REQUIRES: riscv-registered-target
+
+#include <riscv_vector.h>
+#include <stddef.h>
+
+// CONSTANT INDEX
+
+// CHECK-LABEL: @subscript_const_i32(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[VECEXT:%.*]] = extractelement <vscale x 2 x i32> 
[[A:%.*]], i32 0
+// CHECK-NEXT:    ret i32 [[VECEXT]]
+//
+int subscript_const_i32(vint32m1_t a) {
+  return a[0];
----------------
DavidTruby wrote:

For the subscripts, you're missing a necessary change in 
[CGExprScalar.cpp](https://github.com/llvm/llvm-project/blob/9830c433751d9d998f739d74b12a9a5a22928542/clang/lib/CodeGen/CGExprScalar.cpp#L2204)
 that would allow rvalues to be subscritped (e.g. `(a+b)[0]`). That condition 
should probably be `!E->getBase()->getType()->isSubscriptableVectorType()` (and 
probably should have been before anyway).

https://github.com/llvm/llvm-project/pull/192722
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to