xref: /llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/scalable-vectorization-cost-tuning.ll (revision c836b8956d393f98e0d4e136799a33f1bd06e5f5)
1; REQUIRES: asserts
2; RUN: opt -mtriple=aarch64 -mattr=+sve \
3; RUN:     -force-target-instruction-cost=1 -passes=loop-vectorize -S -debug-only=loop-vectorize --disable-output < %s 2>&1 \
4; RUN:     | FileCheck %s --check-prefixes=VSCALEFORTUNING1
5
6; RUN: opt -mtriple=aarch64 -mattr=+sve -mcpu=generic \
7; RUN:     -force-target-instruction-cost=1 -passes=loop-vectorize -S -debug-only=loop-vectorize --disable-output < %s 2>&1 \
8; RUN:     | FileCheck %s --check-prefixes=VSCALEFORTUNING1
9
10; RUN: opt -mtriple=aarch64 -mcpu=neoverse-v1 \
11; RUN:     -force-target-instruction-cost=1 -passes=loop-vectorize -S -debug-only=loop-vectorize --disable-output < %s 2>&1 \
12; RUN:     | FileCheck %s --check-prefixes=VSCALEFORTUNING2
13
14; RUN: opt -mtriple=aarch64 -mcpu=neoverse-n2 \
15; RUN:     -force-target-instruction-cost=1 -passes=loop-vectorize -S -debug-only=loop-vectorize --disable-output < %s 2>&1 \
16; RUN:     | FileCheck %s --check-prefixes=VSCALEFORTUNING1
17
18; RUN: opt -mtriple=aarch64 -mcpu=neoverse-v2 \
19; RUN:     -force-target-instruction-cost=1 -passes=loop-vectorize -S -debug-only=loop-vectorize --disable-output < %s 2>&1 \
20; RUN:     | FileCheck %s --check-prefixes=NEOVERSEV2
21
22; VSCALEFORTUNING1: Cost for VF vscale x 2: 11 (Estimated cost per lane: 5.
23; VSCALEFORTUNING1: Cost for VF vscale x 4: 11 (Estimated cost per lane: 2.
24; VSCALEFORTUNING1: LV: Selecting VF: vscale x 16
25
26; VSCALEFORTUNING2: Cost for VF vscale x 2: 11 (Estimated cost per lane: 2.
27; VSCALEFORTUNING2: Cost for VF vscale x 4: 11 (Estimated cost per lane: 1.
28; VSCALEFORTUNING2: LV: Selecting VF: vscale x 16
29
30; NEOVERSEV2: Cost for VF vscale x 2: 11 (Estimated cost per lane: 5.
31; NEOVERSEV2: Cost for VF vscale x 4: 11 (Estimated cost per lane: 2.
32; NEOVERSEV2: LV: Selecting VF: 16
33
34; VSCALEFORTUNING1: <vscale x 16 x i8>
35; VSCALEFORTUNING2: <vscale x 16 x i8>
36; NEOVERSEV2: <16 x i8>
37define void @test0(ptr %a, ptr %b, ptr %c) #0 {
38entry:
39  br label %loop
40
41loop:
42  %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
43  %arrayidx = getelementptr inbounds i8, ptr %c, i64 %iv
44  %0 = load i8, ptr %arrayidx, align 4
45  %arrayidx2 = getelementptr inbounds i8, ptr %b, i64 %iv
46  %1 = load i8, ptr %arrayidx2, align 4
47  %add = add nsw i8 %0, %1
48  %arrayidx5 = getelementptr inbounds i8, ptr %a, i64 %iv
49  store i8 %add, ptr %arrayidx5, align 4
50  %iv.next = add nuw nsw i64 %iv, 1
51  %exitcond.not = icmp eq i64 %iv.next, 1024
52  br i1 %exitcond.not, label %exit, label %loop
53
54exit:
55  ret void
56}
57