1 ; RUN: opt -mtriple=riscv64 -mattr=+m,+v -passes=loop-vectorize \
2 ; RUN: -riscv-v-vector-bits-max=512 -S -scalable-vectorization=on < %s 2>&1 \
5 ; void test(int *a, int *b, int N) {
6 ; #pragma clang loop vectorize(enable) vectorize_width(2, scalable)
7 ; for (int i=0; i<N; ++i) {
8 ; a[i + 64] = a[i] + b[i];
12 ; CHECK: <vscale x 2 x i32>
13 define void @test(ptr %a, ptr %b) {
18 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
19 %arrayidx = getelementptr inbounds i32, ptr %a, i64 %iv
20 %0 = load i32, ptr %arrayidx, align 4
21 %arrayidx2 = getelementptr inbounds i32, ptr %b, i64 %iv
22 %1 = load i32, ptr %arrayidx2, align 4
23 %add = add nsw i32 %1, %0
24 %2 = add nuw nsw i64 %iv, 64
25 %arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %2
26 store i32 %add, ptr %arrayidx5, align 4
27 %iv.next = add nuw nsw i64 %iv, 1
28 %exitcond.not = icmp eq i64 %iv.next, 1024
29 br i1 %exitcond.not, label %exit, label %loop, !llvm.loop !6
36 !7 = !{!"llvm.loop.vectorize.width", i32 2}
37 !8 = !{!"llvm.loop.vectorize.scalable.enable", i1 true}