Skip to content

Commit 1cf49b9

Browse files
committed
[LV] Pre-commit test for vectorisation of SAXPY unrolled by 5 (NFC).
This test contains a vectorisation example of a loop based on SAXPY manually unrolled by five, as discussed in llvm#148808.
1 parent 958cec0 commit 1cf49b9

File tree

1 file changed

+248
-0
lines changed
  • llvm/test/Transforms/LoopVectorize/AArch64

1 file changed

+248
-0
lines changed
Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt < %s -S -passes=loop-vectorize | FileCheck %s --check-prefix=CHECK
3+
; RUN: opt < %s -S -passes=loop-vectorize -mattr=+sve | FileCheck %s --check-prefix=CHECK-SVE
4+
5+
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
6+
target triple = "aarch64-unknown-linux-gnu"
7+
8+
; This test contains an example of a loop based on SAXPY manually unrolled by
9+
; five:
10+
;
11+
; void saxpy(long n, float a, float *x, float *y) {
12+
; for (int i = 0; i < n; i += 5) {
13+
; y[i] += a * x[i];
14+
; y[i + 1] += a * x[i + 1];
15+
; y[i + 2] += a * x[i + 2];
16+
; y[i + 3] += a * x[i + 3];
17+
; y[i + 4] += a * x[i + 4];
18+
; }
19+
; }
20+
;
21+
; Note: Although the loop is not vectorised with scalable vectors, we need +sve
22+
; for vectorisation due to an interaction with `prefersVectorizedAddressing'.
23+
24+
define void @saxpy(i64 %n, float %a, ptr readonly %x, ptr noalias %y) {
25+
; CHECK-LABEL: define void @saxpy(
26+
; CHECK-SAME: i64 [[N:%.*]], float [[A:%.*]], ptr readonly [[X:%.*]], ptr noalias [[Y:%.*]]) {
27+
; CHECK-NEXT: [[ENTRY:.*:]]
28+
; CHECK-NEXT: [[TMP0:%.*]] = icmp sgt i64 [[N]], 0
29+
; CHECK-NEXT: br i1 [[TMP0]], label %[[LOOP_PREHEADER:.*]], label %[[EXIT:.*]]
30+
; CHECK: [[LOOP_PREHEADER]]:
31+
; CHECK-NEXT: br label %[[LOOP:.*]]
32+
; CHECK: [[LOOP]]:
33+
; CHECK-NEXT: [[I1:%.*]] = phi i64 [ [[I_NEXT:%.*]], %[[LOOP]] ], [ 0, %[[LOOP_PREHEADER]] ]
34+
; CHECK-NEXT: [[XGEP1:%.*]] = getelementptr inbounds nuw float, ptr [[X]], i64 [[I1]]
35+
; CHECK-NEXT: [[X1:%.*]] = load float, ptr [[XGEP1]], align 4
36+
; CHECK-NEXT: [[AX1:%.*]] = fmul fast float [[X1]], [[A]]
37+
; CHECK-NEXT: [[YGEP1:%.*]] = getelementptr inbounds nuw float, ptr [[Y]], i64 [[I1]]
38+
; CHECK-NEXT: [[Y1:%.*]] = load float, ptr [[YGEP1]], align 4
39+
; CHECK-NEXT: [[AXPY1:%.*]] = fadd fast float [[Y1]], [[AX1]]
40+
; CHECK-NEXT: store float [[AXPY1]], ptr [[YGEP1]], align 4
41+
; CHECK-NEXT: [[I2:%.*]] = add nuw nsw i64 [[I1]], 1
42+
; CHECK-NEXT: [[XGEP2:%.*]] = getelementptr inbounds nuw float, ptr [[X]], i64 [[I2]]
43+
; CHECK-NEXT: [[X2:%.*]] = load float, ptr [[XGEP2]], align 4
44+
; CHECK-NEXT: [[AX2:%.*]] = fmul fast float [[X2]], [[A]]
45+
; CHECK-NEXT: [[YGEP2:%.*]] = getelementptr inbounds nuw float, ptr [[Y]], i64 [[I2]]
46+
; CHECK-NEXT: [[Y2:%.*]] = load float, ptr [[YGEP2]], align 4
47+
; CHECK-NEXT: [[AXPY2:%.*]] = fadd fast float [[Y2]], [[AX2]]
48+
; CHECK-NEXT: store float [[AXPY2]], ptr [[YGEP2]], align 4
49+
; CHECK-NEXT: [[I3:%.*]] = add nuw nsw i64 [[I1]], 2
50+
; CHECK-NEXT: [[XGEP3:%.*]] = getelementptr inbounds nuw float, ptr [[X]], i64 [[I3]]
51+
; CHECK-NEXT: [[X3:%.*]] = load float, ptr [[XGEP3]], align 4
52+
; CHECK-NEXT: [[AX3:%.*]] = fmul fast float [[X3]], [[A]]
53+
; CHECK-NEXT: [[YGEP3:%.*]] = getelementptr inbounds nuw float, ptr [[Y]], i64 [[I3]]
54+
; CHECK-NEXT: [[Y3:%.*]] = load float, ptr [[YGEP3]], align 4
55+
; CHECK-NEXT: [[AXPY3:%.*]] = fadd fast float [[Y3]], [[AX3]]
56+
; CHECK-NEXT: store float [[AXPY3]], ptr [[YGEP3]], align 4
57+
; CHECK-NEXT: [[I4:%.*]] = add nuw nsw i64 [[I1]], 3
58+
; CHECK-NEXT: [[XGEP4:%.*]] = getelementptr inbounds nuw float, ptr [[X]], i64 [[I4]]
59+
; CHECK-NEXT: [[X4:%.*]] = load float, ptr [[XGEP4]], align 4
60+
; CHECK-NEXT: [[AX4:%.*]] = fmul fast float [[X4]], [[A]]
61+
; CHECK-NEXT: [[YGEP4:%.*]] = getelementptr inbounds nuw float, ptr [[Y]], i64 [[I4]]
62+
; CHECK-NEXT: [[Y4:%.*]] = load float, ptr [[YGEP4]], align 4
63+
; CHECK-NEXT: [[AXPY4:%.*]] = fadd fast float [[Y4]], [[AX4]]
64+
; CHECK-NEXT: store float [[AXPY4]], ptr [[YGEP4]], align 4
65+
; CHECK-NEXT: [[I5:%.*]] = add nuw nsw i64 [[I1]], 4
66+
; CHECK-NEXT: [[XGEP5:%.*]] = getelementptr inbounds nuw float, ptr [[X]], i64 [[I5]]
67+
; CHECK-NEXT: [[X5:%.*]] = load float, ptr [[XGEP5]], align 4
68+
; CHECK-NEXT: [[AX5:%.*]] = fmul fast float [[X5]], [[A]]
69+
; CHECK-NEXT: [[YGEP5:%.*]] = getelementptr inbounds nuw float, ptr [[Y]], i64 [[I5]]
70+
; CHECK-NEXT: [[Y5:%.*]] = load float, ptr [[YGEP5]], align 4
71+
; CHECK-NEXT: [[AXPY5:%.*]] = fadd fast float [[Y5]], [[AX5]]
72+
; CHECK-NEXT: store float [[AXPY5]], ptr [[YGEP5]], align 4
73+
; CHECK-NEXT: [[I_NEXT]] = add nuw nsw i64 [[I1]], 5
74+
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i64 [[N]], [[I_NEXT]]
75+
; CHECK-NEXT: br i1 [[CMP]], label %[[LOOP]], label %[[EXIT_LOOPEXIT:.*]]
76+
; CHECK: [[EXIT_LOOPEXIT]]:
77+
; CHECK-NEXT: br label %[[EXIT]]
78+
; CHECK: [[EXIT]]:
79+
; CHECK-NEXT: ret void
80+
;
81+
; CHECK-SVE-LABEL: define void @saxpy(
82+
; CHECK-SVE-SAME: i64 [[N:%.*]], float [[A:%.*]], ptr readonly [[X:%.*]], ptr noalias [[Y:%.*]]) #[[ATTR0:[0-9]+]] {
83+
; CHECK-SVE-NEXT: [[ENTRY:.*:]]
84+
; CHECK-SVE-NEXT: [[TMP0:%.*]] = icmp sgt i64 [[N]], 0
85+
; CHECK-SVE-NEXT: br i1 [[TMP0]], label %[[LOOP_PREHEADER:.*]], label %[[EXIT:.*]]
86+
; CHECK-SVE: [[LOOP_PREHEADER]]:
87+
; CHECK-SVE-NEXT: [[TMP1:%.*]] = add i64 [[N]], -1
88+
; CHECK-SVE-NEXT: [[TMP2:%.*]] = udiv i64 [[TMP1]], 5
89+
; CHECK-SVE-NEXT: [[TMP3:%.*]] = add nuw nsw i64 [[TMP2]], 1
90+
; CHECK-SVE-NEXT: [[MIN_ITERS_CHECK:%.*]] = icmp ult i64 [[TMP3]], 2
91+
; CHECK-SVE-NEXT: br i1 [[MIN_ITERS_CHECK]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
92+
; CHECK-SVE: [[VECTOR_PH]]:
93+
; CHECK-SVE-NEXT: [[N_MOD_VF:%.*]] = urem i64 [[TMP3]], 2
94+
; CHECK-SVE-NEXT: [[N_VEC:%.*]] = sub i64 [[TMP3]], [[N_MOD_VF]]
95+
; CHECK-SVE-NEXT: [[TMP4:%.*]] = mul i64 [[N_VEC]], 5
96+
; CHECK-SVE-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <2 x float> poison, float [[A]], i64 0
97+
; CHECK-SVE-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <2 x float> [[BROADCAST_SPLATINSERT]], <2 x float> poison, <2 x i32> zeroinitializer
98+
; CHECK-SVE-NEXT: br label %[[VECTOR_BODY:.*]]
99+
; CHECK-SVE: [[VECTOR_BODY]]:
100+
; CHECK-SVE-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
101+
; CHECK-SVE-NEXT: [[OFFSET_IDX:%.*]] = mul i64 [[INDEX]], 5
102+
; CHECK-SVE-NEXT: [[TMP5:%.*]] = getelementptr inbounds nuw float, ptr [[X]], i64 [[OFFSET_IDX]]
103+
; CHECK-SVE-NEXT: [[WIDE_VEC:%.*]] = load <10 x float>, ptr [[TMP5]], align 4
104+
; CHECK-SVE-NEXT: [[STRIDED_VEC:%.*]] = shufflevector <10 x float> [[WIDE_VEC]], <10 x float> poison, <2 x i32> <i32 0, i32 5>
105+
; CHECK-SVE-NEXT: [[STRIDED_VEC1:%.*]] = shufflevector <10 x float> [[WIDE_VEC]], <10 x float> poison, <2 x i32> <i32 1, i32 6>
106+
; CHECK-SVE-NEXT: [[STRIDED_VEC2:%.*]] = shufflevector <10 x float> [[WIDE_VEC]], <10 x float> poison, <2 x i32> <i32 2, i32 7>
107+
; CHECK-SVE-NEXT: [[STRIDED_VEC3:%.*]] = shufflevector <10 x float> [[WIDE_VEC]], <10 x float> poison, <2 x i32> <i32 3, i32 8>
108+
; CHECK-SVE-NEXT: [[STRIDED_VEC4:%.*]] = shufflevector <10 x float> [[WIDE_VEC]], <10 x float> poison, <2 x i32> <i32 4, i32 9>
109+
; CHECK-SVE-NEXT: [[TMP6:%.*]] = fmul fast <2 x float> [[STRIDED_VEC]], [[BROADCAST_SPLAT]]
110+
; CHECK-SVE-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw float, ptr [[Y]], i64 [[OFFSET_IDX]]
111+
; CHECK-SVE-NEXT: [[WIDE_VEC5:%.*]] = load <10 x float>, ptr [[TMP7]], align 4
112+
; CHECK-SVE-NEXT: [[STRIDED_VEC6:%.*]] = shufflevector <10 x float> [[WIDE_VEC5]], <10 x float> poison, <2 x i32> <i32 0, i32 5>
113+
; CHECK-SVE-NEXT: [[STRIDED_VEC7:%.*]] = shufflevector <10 x float> [[WIDE_VEC5]], <10 x float> poison, <2 x i32> <i32 1, i32 6>
114+
; CHECK-SVE-NEXT: [[STRIDED_VEC8:%.*]] = shufflevector <10 x float> [[WIDE_VEC5]], <10 x float> poison, <2 x i32> <i32 2, i32 7>
115+
; CHECK-SVE-NEXT: [[STRIDED_VEC9:%.*]] = shufflevector <10 x float> [[WIDE_VEC5]], <10 x float> poison, <2 x i32> <i32 3, i32 8>
116+
; CHECK-SVE-NEXT: [[STRIDED_VEC10:%.*]] = shufflevector <10 x float> [[WIDE_VEC5]], <10 x float> poison, <2 x i32> <i32 4, i32 9>
117+
; CHECK-SVE-NEXT: [[TMP8:%.*]] = fadd fast <2 x float> [[STRIDED_VEC6]], [[TMP6]]
118+
; CHECK-SVE-NEXT: [[TMP9:%.*]] = fmul fast <2 x float> [[STRIDED_VEC1]], [[BROADCAST_SPLAT]]
119+
; CHECK-SVE-NEXT: [[TMP10:%.*]] = fadd fast <2 x float> [[STRIDED_VEC7]], [[TMP9]]
120+
; CHECK-SVE-NEXT: [[TMP11:%.*]] = fmul fast <2 x float> [[STRIDED_VEC2]], [[BROADCAST_SPLAT]]
121+
; CHECK-SVE-NEXT: [[TMP12:%.*]] = fadd fast <2 x float> [[STRIDED_VEC8]], [[TMP11]]
122+
; CHECK-SVE-NEXT: [[TMP13:%.*]] = fmul fast <2 x float> [[STRIDED_VEC3]], [[BROADCAST_SPLAT]]
123+
; CHECK-SVE-NEXT: [[TMP14:%.*]] = fadd fast <2 x float> [[STRIDED_VEC9]], [[TMP13]]
124+
; CHECK-SVE-NEXT: [[TMP15:%.*]] = fmul fast <2 x float> [[STRIDED_VEC4]], [[BROADCAST_SPLAT]]
125+
; CHECK-SVE-NEXT: [[TMP16:%.*]] = fadd fast <2 x float> [[STRIDED_VEC10]], [[TMP15]]
126+
; CHECK-SVE-NEXT: [[TMP17:%.*]] = shufflevector <2 x float> [[TMP8]], <2 x float> [[TMP10]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
127+
; CHECK-SVE-NEXT: [[TMP18:%.*]] = shufflevector <2 x float> [[TMP12]], <2 x float> [[TMP14]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
128+
; CHECK-SVE-NEXT: [[TMP19:%.*]] = shufflevector <4 x float> [[TMP17]], <4 x float> [[TMP18]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
129+
; CHECK-SVE-NEXT: [[TMP20:%.*]] = shufflevector <2 x float> [[TMP16]], <2 x float> poison, <8 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
130+
; CHECK-SVE-NEXT: [[TMP21:%.*]] = shufflevector <8 x float> [[TMP19]], <8 x float> [[TMP20]], <10 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9>
131+
; CHECK-SVE-NEXT: [[INTERLEAVED_VEC:%.*]] = shufflevector <10 x float> [[TMP21]], <10 x float> poison, <10 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 1, i32 3, i32 5, i32 7, i32 9>
132+
; CHECK-SVE-NEXT: store <10 x float> [[INTERLEAVED_VEC]], ptr [[TMP7]], align 4
133+
; CHECK-SVE-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 2
134+
; CHECK-SVE-NEXT: [[TMP22:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]]
135+
; CHECK-SVE-NEXT: br i1 [[TMP22]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
136+
; CHECK-SVE: [[MIDDLE_BLOCK]]:
137+
; CHECK-SVE-NEXT: [[CMP_N:%.*]] = icmp eq i64 [[TMP3]], [[N_VEC]]
138+
; CHECK-SVE-NEXT: br i1 [[CMP_N]], label %[[EXIT_LOOPEXIT:.*]], label %[[SCALAR_PH]]
139+
; CHECK-SVE: [[SCALAR_PH]]:
140+
; CHECK-SVE-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ [[TMP4]], %[[MIDDLE_BLOCK]] ], [ 0, %[[LOOP_PREHEADER]] ]
141+
; CHECK-SVE-NEXT: br label %[[LOOP:.*]]
142+
; CHECK-SVE: [[LOOP]]:
143+
; CHECK-SVE-NEXT: [[I1:%.*]] = phi i64 [ [[I_NEXT:%.*]], %[[LOOP]] ], [ [[BC_RESUME_VAL]], %[[SCALAR_PH]] ]
144+
; CHECK-SVE-NEXT: [[XGEP1:%.*]] = getelementptr inbounds nuw float, ptr [[X]], i64 [[I1]]
145+
; CHECK-SVE-NEXT: [[X1:%.*]] = load float, ptr [[XGEP1]], align 4
146+
; CHECK-SVE-NEXT: [[AX1:%.*]] = fmul fast float [[X1]], [[A]]
147+
; CHECK-SVE-NEXT: [[YGEP1:%.*]] = getelementptr inbounds nuw float, ptr [[Y]], i64 [[I1]]
148+
; CHECK-SVE-NEXT: [[Y1:%.*]] = load float, ptr [[YGEP1]], align 4
149+
; CHECK-SVE-NEXT: [[AXPY1:%.*]] = fadd fast float [[Y1]], [[AX1]]
150+
; CHECK-SVE-NEXT: store float [[AXPY1]], ptr [[YGEP1]], align 4
151+
; CHECK-SVE-NEXT: [[I2:%.*]] = add nuw nsw i64 [[I1]], 1
152+
; CHECK-SVE-NEXT: [[XGEP2:%.*]] = getelementptr inbounds nuw float, ptr [[X]], i64 [[I2]]
153+
; CHECK-SVE-NEXT: [[X2:%.*]] = load float, ptr [[XGEP2]], align 4
154+
; CHECK-SVE-NEXT: [[AX2:%.*]] = fmul fast float [[X2]], [[A]]
155+
; CHECK-SVE-NEXT: [[YGEP2:%.*]] = getelementptr inbounds nuw float, ptr [[Y]], i64 [[I2]]
156+
; CHECK-SVE-NEXT: [[Y2:%.*]] = load float, ptr [[YGEP2]], align 4
157+
; CHECK-SVE-NEXT: [[AXPY2:%.*]] = fadd fast float [[Y2]], [[AX2]]
158+
; CHECK-SVE-NEXT: store float [[AXPY2]], ptr [[YGEP2]], align 4
159+
; CHECK-SVE-NEXT: [[I3:%.*]] = add nuw nsw i64 [[I1]], 2
160+
; CHECK-SVE-NEXT: [[XGEP3:%.*]] = getelementptr inbounds nuw float, ptr [[X]], i64 [[I3]]
161+
; CHECK-SVE-NEXT: [[X3:%.*]] = load float, ptr [[XGEP3]], align 4
162+
; CHECK-SVE-NEXT: [[AX3:%.*]] = fmul fast float [[X3]], [[A]]
163+
; CHECK-SVE-NEXT: [[YGEP3:%.*]] = getelementptr inbounds nuw float, ptr [[Y]], i64 [[I3]]
164+
; CHECK-SVE-NEXT: [[Y3:%.*]] = load float, ptr [[YGEP3]], align 4
165+
; CHECK-SVE-NEXT: [[AXPY3:%.*]] = fadd fast float [[Y3]], [[AX3]]
166+
; CHECK-SVE-NEXT: store float [[AXPY3]], ptr [[YGEP3]], align 4
167+
; CHECK-SVE-NEXT: [[I4:%.*]] = add nuw nsw i64 [[I1]], 3
168+
; CHECK-SVE-NEXT: [[XGEP4:%.*]] = getelementptr inbounds nuw float, ptr [[X]], i64 [[I4]]
169+
; CHECK-SVE-NEXT: [[X4:%.*]] = load float, ptr [[XGEP4]], align 4
170+
; CHECK-SVE-NEXT: [[AX4:%.*]] = fmul fast float [[X4]], [[A]]
171+
; CHECK-SVE-NEXT: [[YGEP4:%.*]] = getelementptr inbounds nuw float, ptr [[Y]], i64 [[I4]]
172+
; CHECK-SVE-NEXT: [[Y4:%.*]] = load float, ptr [[YGEP4]], align 4
173+
; CHECK-SVE-NEXT: [[AXPY4:%.*]] = fadd fast float [[Y4]], [[AX4]]
174+
; CHECK-SVE-NEXT: store float [[AXPY4]], ptr [[YGEP4]], align 4
175+
; CHECK-SVE-NEXT: [[I5:%.*]] = add nuw nsw i64 [[I1]], 4
176+
; CHECK-SVE-NEXT: [[XGEP5:%.*]] = getelementptr inbounds nuw float, ptr [[X]], i64 [[I5]]
177+
; CHECK-SVE-NEXT: [[X5:%.*]] = load float, ptr [[XGEP5]], align 4
178+
; CHECK-SVE-NEXT: [[AX5:%.*]] = fmul fast float [[X5]], [[A]]
179+
; CHECK-SVE-NEXT: [[YGEP5:%.*]] = getelementptr inbounds nuw float, ptr [[Y]], i64 [[I5]]
180+
; CHECK-SVE-NEXT: [[Y5:%.*]] = load float, ptr [[YGEP5]], align 4
181+
; CHECK-SVE-NEXT: [[AXPY5:%.*]] = fadd fast float [[Y5]], [[AX5]]
182+
; CHECK-SVE-NEXT: store float [[AXPY5]], ptr [[YGEP5]], align 4
183+
; CHECK-SVE-NEXT: [[I_NEXT]] = add nuw nsw i64 [[I1]], 5
184+
; CHECK-SVE-NEXT: [[CMP:%.*]] = icmp sgt i64 [[N]], [[I_NEXT]]
185+
; CHECK-SVE-NEXT: br i1 [[CMP]], label %[[LOOP]], label %[[EXIT_LOOPEXIT]], !llvm.loop [[LOOP3:![0-9]+]]
186+
; CHECK-SVE: [[EXIT_LOOPEXIT]]:
187+
; CHECK-SVE-NEXT: br label %[[EXIT]]
188+
; CHECK-SVE: [[EXIT]]:
189+
; CHECK-SVE-NEXT: ret void
190+
;
191+
entry:
192+
%0 = icmp sgt i64 %n, 0
193+
br i1 %0, label %loop, label %exit
194+
195+
loop:
196+
%i1 = phi i64 [ %i.next, %loop ], [ 0, %entry ]
197+
%xgep1 = getelementptr inbounds nuw float, ptr %x, i64 %i1
198+
%x1 = load float, ptr %xgep1, align 4
199+
%ax1 = fmul fast float %x1, %a
200+
%ygep1 = getelementptr inbounds nuw float, ptr %y, i64 %i1
201+
%y1 = load float, ptr %ygep1, align 4
202+
%axpy1 = fadd fast float %y1, %ax1
203+
store float %axpy1, ptr %ygep1, align 4
204+
%i2 = add nuw nsw i64 %i1, 1
205+
%xgep2 = getelementptr inbounds nuw float, ptr %x, i64 %i2
206+
%x2 = load float, ptr %xgep2, align 4
207+
%ax2 = fmul fast float %x2, %a
208+
%ygep2 = getelementptr inbounds nuw float, ptr %y, i64 %i2
209+
%y2 = load float, ptr %ygep2, align 4
210+
%axpy2 = fadd fast float %y2, %ax2
211+
store float %axpy2, ptr %ygep2, align 4
212+
%i3 = add nuw nsw i64 %i1, 2
213+
%xgep3 = getelementptr inbounds nuw float, ptr %x, i64 %i3
214+
%x3 = load float, ptr %xgep3, align 4
215+
%ax3 = fmul fast float %x3, %a
216+
%ygep3 = getelementptr inbounds nuw float, ptr %y, i64 %i3
217+
%y3 = load float, ptr %ygep3, align 4
218+
%axpy3 = fadd fast float %y3, %ax3
219+
store float %axpy3, ptr %ygep3, align 4
220+
%i4 = add nuw nsw i64 %i1, 3
221+
%xgep4 = getelementptr inbounds nuw float, ptr %x, i64 %i4
222+
%x4 = load float, ptr %xgep4, align 4
223+
%ax4 = fmul fast float %x4, %a
224+
%ygep4 = getelementptr inbounds nuw float, ptr %y, i64 %i4
225+
%y4 = load float, ptr %ygep4, align 4
226+
%axpy4 = fadd fast float %y4, %ax4
227+
store float %axpy4, ptr %ygep4, align 4
228+
%i5 = add nuw nsw i64 %i1, 4
229+
%xgep5 = getelementptr inbounds nuw float, ptr %x, i64 %i5
230+
%x5 = load float, ptr %xgep5, align 4
231+
%ax5 = fmul fast float %x5, %a
232+
%ygep5 = getelementptr inbounds nuw float, ptr %y, i64 %i5
233+
%y5 = load float, ptr %ygep5, align 4
234+
%axpy5 = fadd fast float %y5, %ax5
235+
store float %axpy5, ptr %ygep5, align 4
236+
%i.next = add nuw nsw i64 %i1, 5
237+
%cmp = icmp sgt i64 %n, %i.next
238+
br i1 %cmp, label %loop, label %exit
239+
240+
exit:
241+
ret void
242+
}
243+
;.
244+
; CHECK-SVE: [[LOOP0]] = distinct !{[[LOOP0]], [[META1:![0-9]+]], [[META2:![0-9]+]]}
245+
; CHECK-SVE: [[META1]] = !{!"llvm.loop.isvectorized", i32 1}
246+
; CHECK-SVE: [[META2]] = !{!"llvm.loop.unroll.runtime.disable"}
247+
; CHECK-SVE: [[LOOP3]] = distinct !{[[LOOP3]], [[META2]], [[META1]]}
248+
;.

0 commit comments

Comments
 (0)