1 ; RUN: sed -e s/REPLACE_PSTATE_MACRO/aarch64_pstate_sm_enabled/ %s | opt -passes=loop-vectorize,slp-vectorizer -S - | FileCheck %s --check-prefix=CHECK
2 ; RUN: sed -e s/REPLACE_PSTATE_MACRO/aarch64_pstate_sm_enabled/ %s | opt -passes=loop-vectorize,slp-vectorizer -S -enable-scalable-autovec-in-streaming-mode - | FileCheck %s --check-prefix=CHECK-FORCE-SCALABLE
3 ; RUN: sed -e s/REPLACE_PSTATE_MACRO/aarch64_pstate_sm_enabled/ %s | opt -passes=loop-vectorize,slp-vectorizer -S -enable-fixedwidth-autovec-in-streaming-mode - | FileCheck %s --check-prefix=CHECK-FORCE-FIXEDWIDTH
5 ; RUN: sed -e s/REPLACE_PSTATE_MACRO/aarch64_pstate_sm_compatible/ %s | opt -passes=loop-vectorize,slp-vectorizer -S - | FileCheck %s --check-prefix=CHECK
6 ; RUN: sed -e s/REPLACE_PSTATE_MACRO/aarch64_pstate_sm_compatible/ %s | opt -passes=loop-vectorize,slp-vectorizer -S -enable-scalable-autovec-in-streaming-mode - | FileCheck %s --check-prefix=CHECK-FORCE-SCALABLE
7 ; RUN: sed -e s/REPLACE_PSTATE_MACRO/aarch64_pstate_sm_compatible/ %s | opt -passes=loop-vectorize,slp-vectorizer -S -enable-fixedwidth-autovec-in-streaming-mode - | FileCheck %s --check-prefix=CHECK-FORCE-FIXEDWIDTH
9 ; RUN: sed -e s/REPLACE_PSTATE_MACRO/aarch64_pstate_sm_body/ %s | opt -passes=loop-vectorize,slp-vectorizer -S - | FileCheck %s --check-prefix=CHECK
10 ; RUN: sed -e s/REPLACE_PSTATE_MACRO/aarch64_pstate_sm_body/ %s | opt -passes=loop-vectorize,slp-vectorizer -S -enable-scalable-autovec-in-streaming-mode - | FileCheck %s --check-prefix=CHECK-FORCE-SCALABLE
11 ; RUN: sed -e s/REPLACE_PSTATE_MACRO/aarch64_pstate_sm_body/ %s | opt -passes=loop-vectorize,slp-vectorizer -S -enable-fixedwidth-autovec-in-streaming-mode - | FileCheck %s --check-prefix=CHECK-FORCE-FIXEDWIDTH
13 target triple = "aarch64-unknown-linux-gnu"
15 attributes #0 = { vscale_range(1,16) "target-features"="+neon,+sme,+sve2" "REPLACE_PSTATE_MACRO" }
17 define void @test_fixedwidth_loopvec(ptr noalias %dst, ptr readonly %src, i32 %N) #0 {
18 ; CHECK-LABEL: @test_fixedwidth_loopvec
19 ; CHECK-NOT: <{{[1-9]+}} x i32>
20 ; CHECK-FORCE-FIXEDWIDTH-LABEL: @test_fixedwidth_loopvec
21 ; CHECK-FORCE-FIXEDWIDTH: <{{[1-9]+}} x i32>
23 %cmp6 = icmp sgt i32 %N, 0
24 br i1 %cmp6, label %for.body.preheader, label %for.cond.cleanup
26 for.body.preheader: ; preds = %entry
27 %wide.trip.count = zext i32 %N to i64
30 for.cond.cleanup: ; preds = %for.body, %entry
33 for.body: ; preds = %for.body.preheader, %for.body
34 %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
35 %arrayidx = getelementptr inbounds i32, ptr %src, i64 %indvars.iv
36 %0 = load i32, ptr %arrayidx, align 4
37 %add = add nsw i32 %0, 42
38 %arrayidx2 = getelementptr inbounds i32, ptr %dst, i64 %indvars.iv
39 store i32 %add, ptr %arrayidx2, align 4
40 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
41 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
42 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !0
45 !0 = distinct !{!0, !1, !2, !3}
46 !1 = !{!"llvm.loop.mustprogress"}
47 !2 = !{!"llvm.loop.interleave.count", i32 1}
48 !3 = !{!"llvm.loop.vectorize.scalable.enable", i1 false}
50 define void @test_scalable_loopvec(ptr noalias %dst, ptr readonly %src, i32 %N) #0 {
51 ; CHECK-LABEL: @test_scalable_loopvec
52 ; CHECK-NOT: <vscale x {{[1-9]+}} x i32>
53 ; CHECK-FORCE-SCALABLE-LABEL: @test_fixedwidth_loopvec
54 ; CHECK-FORCE-SCALABLE-LABEL: <vscale x {{[1-9]+}} x i32>
56 %cmp6 = icmp sgt i32 %N, 0
57 br i1 %cmp6, label %for.body.preheader, label %for.cond.cleanup
59 for.body.preheader: ; preds = %entry
60 %wide.trip.count = zext i32 %N to i64
63 for.cond.cleanup: ; preds = %for.body, %entry
66 for.body: ; preds = %for.body.preheader, %for.body
67 %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
68 %arrayidx = getelementptr inbounds i32, ptr %src, i64 %indvars.iv
69 %0 = load i32, ptr %arrayidx, align 4
70 %add = add nsw i32 %0, 42
71 %arrayidx2 = getelementptr inbounds i32, ptr %dst, i64 %indvars.iv
72 store i32 %add, ptr %arrayidx2, align 4
73 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
74 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
75 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !4
78 !4 = distinct !{!4, !5, !6, !7}
79 !5 = !{!"llvm.loop.mustprogress"}
80 !6 = !{!"llvm.loop.interleave.count", i32 1}
81 !7 = !{!"llvm.loop.vectorize.scalable.enable", i1 true}
83 define void @test_slp(ptr noalias %dst, ptr readonly %src, i32 %N) #0 {
84 ; CHECK-LABEL: @test_slp
85 ; CHECK-NOT: <{{[1-9]+}} x i32>
86 ; CHECK-FORCE-FIXEDWIDTH-LABEL: @test_slp
87 ; CHECK-FORCE-FIXEDWIDTH: <{{[1-9]+}} x i32>
89 %cmp6 = icmp sgt i32 %N, 0
90 br i1 %cmp6, label %for.body.preheader, label %for.cond.cleanup
92 for.body.preheader: ; preds = %entry
93 %wide.trip.count = zext i32 %N to i64
96 for.cond.cleanup: ; preds = %for.body, %entry
99 for.body: ; preds = %for.body.preheader, %for.body
100 %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
101 %arrayidx = getelementptr inbounds i32, ptr %src, i64 %indvars.iv
102 %0 = load i32, ptr %arrayidx, align 4
103 %add = add nsw i32 %0, 42
104 %arrayidx2 = getelementptr inbounds i32, ptr %dst, i64 %indvars.iv
105 store i32 %add, ptr %arrayidx2, align 4
106 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
107 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
108 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !8
111 !8 = distinct !{!8, !9, !10, !11}
112 !9 = !{!"llvm.loop.mustprogress"}
113 !10 = !{!"llvm.loop.interleave.count", i32 4}
114 !11 = !{!"llvm.loop.vectorize.width", i32 1}