1; REQUIRES: asserts
2; RUN: opt -mtriple=aarch64 -mattr=+sve \
3; RUN:     -force-target-instruction-cost=1 -loop-vectorize -S -debug-only=loop-vectorize < %s 2>&1 \
4; RUN:     | FileCheck %s --check-prefixes=GENERIC,VF-VSCALE4
5
6; RUN: opt -mtriple=aarch64 -mattr=+sve -mcpu=generic \
7; RUN:     -force-target-instruction-cost=1 -loop-vectorize -S -debug-only=loop-vectorize < %s 2>&1 \
8; RUN:     | FileCheck %s --check-prefixes=GENERIC,VF-VSCALE4
9
10; RUN: opt -mtriple=aarch64 -mcpu=neoverse-v1 \
11; RUN:     -force-target-instruction-cost=1 -loop-vectorize -S -debug-only=loop-vectorize < %s 2>&1 \
12; RUN:     | FileCheck %s --check-prefixes=NEOVERSE-V1,VF-VSCALE4
13
14; RUN: opt -mtriple=aarch64 -mcpu=neoverse-n2 \
15; RUN:     -force-target-instruction-cost=1 -loop-vectorize -S -debug-only=loop-vectorize < %s 2>&1 \
16; RUN:     | FileCheck %s --check-prefixes=NEOVERSE-N2,VF-VSCALE4
17
18; RUN: opt -mtriple=aarch64 -mcpu=neoverse-n2 \
19; RUN:     -force-target-instruction-cost=1 -loop-vectorize -S -debug-only=loop-vectorize < %s 2>&1 \
20; RUN:     | FileCheck %s --check-prefixes=NEOVERSE-N2,VF-VSCALE4
21
22; GENERIC: LV: Vector loop of width vscale x 2 costs: 3 (assuming a minimum vscale of 2).
23; GENERIC: LV: Vector loop of width vscale x 4 costs: 1 (assuming a minimum vscale of 2).
24
25; NEOVERSE-V1: LV: Vector loop of width vscale x 2 costs: 3 (assuming a minimum vscale of 2).
26; NEOVERSE-V1: LV: Vector loop of width vscale x 4 costs: 1 (assuming a minimum vscale of 2).
27
28; NEOVERSE-N2: LV: Vector loop of width vscale x 2 costs: 6 (assuming a minimum vscale of 1).
29; NEOVERSE-N2: LV: Vector loop of width vscale x 4 costs: 3 (assuming a minimum vscale of 1).
30
31; VF-4: <4 x i32>
32; VF-VSCALE4: <16 x i32>
33define void @test0(i32* %a, i8* %b, i32* %c) #0 {
34entry:
35  br label %loop
36
37loop:
38  %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
39  %arrayidx = getelementptr inbounds i32, i32* %c, i64 %iv
40  %0 = load i32, i32* %arrayidx, align 4
41  %arrayidx2 = getelementptr inbounds i8, i8* %b, i64 %iv
42  %1 = load i8, i8* %arrayidx2, align 4
43  %zext = zext i8 %1 to i32
44  %add = add nsw i32 %zext, %0
45  %arrayidx5 = getelementptr inbounds i32, i32* %a, i64 %iv
46  store i32 %add, i32* %arrayidx5, align 4
47  %iv.next = add nuw nsw i64 %iv, 1
48  %exitcond.not = icmp eq i64 %iv.next, 1024
49  br i1 %exitcond.not, label %exit, label %loop
50
51exit:
52  ret void
53}
54
55