1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // REQUIRES: aarch64-registered-target
3 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s
4 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK
5 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
8 // CHECK-LABEL: @test_svcntw(
10 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.vscale.i64()
11 // CHECK-NEXT: [[TMP1:%.*]] = shl nuw nsw i64 [[TMP0]], 2
12 // CHECK-NEXT: ret i64 [[TMP1]]
14 // CPP-CHECK-LABEL: @_Z11test_svcntwv(
15 // CPP-CHECK-NEXT: entry:
16 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.vscale.i64()
17 // CPP-CHECK-NEXT: [[TMP1:%.*]] = shl nuw nsw i64 [[TMP0]], 2
18 // CPP-CHECK-NEXT: ret i64 [[TMP1]]
20 uint64_t test_svcntw()
25 // CHECK-LABEL: @test_svcntw_pat(
27 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 0)
28 // CHECK-NEXT: ret i64 [[TMP0]]
30 // CPP-CHECK-LABEL: @_Z15test_svcntw_patv(
31 // CPP-CHECK-NEXT: entry:
32 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 0)
33 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
35 uint64_t test_svcntw_pat()
37 return svcntw_pat(SV_POW2
);
40 // CHECK-LABEL: @test_svcntw_pat_1(
42 // CHECK-NEXT: ret i64 1
44 // CPP-CHECK-LABEL: @_Z17test_svcntw_pat_1v(
45 // CPP-CHECK-NEXT: entry:
46 // CPP-CHECK-NEXT: ret i64 1
48 uint64_t test_svcntw_pat_1()
50 return svcntw_pat(SV_VL1
);
53 // CHECK-LABEL: @test_svcntw_pat_2(
55 // CHECK-NEXT: ret i64 2
57 // CPP-CHECK-LABEL: @_Z17test_svcntw_pat_2v(
58 // CPP-CHECK-NEXT: entry:
59 // CPP-CHECK-NEXT: ret i64 2
61 uint64_t test_svcntw_pat_2()
63 return svcntw_pat(SV_VL2
);
66 // CHECK-LABEL: @test_svcntw_pat_3(
68 // CHECK-NEXT: ret i64 3
70 // CPP-CHECK-LABEL: @_Z17test_svcntw_pat_3v(
71 // CPP-CHECK-NEXT: entry:
72 // CPP-CHECK-NEXT: ret i64 3
74 uint64_t test_svcntw_pat_3()
76 return svcntw_pat(SV_VL3
);
79 // CHECK-LABEL: @test_svcntw_pat_4(
81 // CHECK-NEXT: ret i64 4
83 // CPP-CHECK-LABEL: @_Z17test_svcntw_pat_4v(
84 // CPP-CHECK-NEXT: entry:
85 // CPP-CHECK-NEXT: ret i64 4
87 uint64_t test_svcntw_pat_4()
89 return svcntw_pat(SV_VL4
);
92 // CHECK-LABEL: @test_svcntw_pat_5(
94 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 5)
95 // CHECK-NEXT: ret i64 [[TMP0]]
97 // CPP-CHECK-LABEL: @_Z17test_svcntw_pat_5v(
98 // CPP-CHECK-NEXT: entry:
99 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 5)
100 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
102 uint64_t test_svcntw_pat_5()
104 return svcntw_pat(SV_VL5
);
107 // CHECK-LABEL: @test_svcntw_pat_6(
108 // CHECK-NEXT: entry:
109 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 6)
110 // CHECK-NEXT: ret i64 [[TMP0]]
112 // CPP-CHECK-LABEL: @_Z17test_svcntw_pat_6v(
113 // CPP-CHECK-NEXT: entry:
114 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 6)
115 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
117 uint64_t test_svcntw_pat_6()
119 return svcntw_pat(SV_VL6
);
122 // CHECK-LABEL: @test_svcntw_pat_7(
123 // CHECK-NEXT: entry:
124 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 7)
125 // CHECK-NEXT: ret i64 [[TMP0]]
127 // CPP-CHECK-LABEL: @_Z17test_svcntw_pat_7v(
128 // CPP-CHECK-NEXT: entry:
129 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 7)
130 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
132 uint64_t test_svcntw_pat_7()
134 return svcntw_pat(SV_VL7
);
137 // CHECK-LABEL: @test_svcntw_pat_8(
138 // CHECK-NEXT: entry:
139 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 8)
140 // CHECK-NEXT: ret i64 [[TMP0]]
142 // CPP-CHECK-LABEL: @_Z17test_svcntw_pat_8v(
143 // CPP-CHECK-NEXT: entry:
144 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 8)
145 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
147 uint64_t test_svcntw_pat_8()
149 return svcntw_pat(SV_VL8
);
152 // CHECK-LABEL: @test_svcntw_pat_9(
153 // CHECK-NEXT: entry:
154 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 9)
155 // CHECK-NEXT: ret i64 [[TMP0]]
157 // CPP-CHECK-LABEL: @_Z17test_svcntw_pat_9v(
158 // CPP-CHECK-NEXT: entry:
159 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 9)
160 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
162 uint64_t test_svcntw_pat_9()
164 return svcntw_pat(SV_VL16
);
167 // CHECK-LABEL: @test_svcntw_pat_10(
168 // CHECK-NEXT: entry:
169 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 10)
170 // CHECK-NEXT: ret i64 [[TMP0]]
172 // CPP-CHECK-LABEL: @_Z18test_svcntw_pat_10v(
173 // CPP-CHECK-NEXT: entry:
174 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 10)
175 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
177 uint64_t test_svcntw_pat_10()
179 return svcntw_pat(SV_VL32
);
182 // CHECK-LABEL: @test_svcntw_pat_11(
183 // CHECK-NEXT: entry:
184 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 11)
185 // CHECK-NEXT: ret i64 [[TMP0]]
187 // CPP-CHECK-LABEL: @_Z18test_svcntw_pat_11v(
188 // CPP-CHECK-NEXT: entry:
189 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 11)
190 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
192 uint64_t test_svcntw_pat_11()
194 return svcntw_pat(SV_VL64
);
197 // CHECK-LABEL: @test_svcntw_pat_12(
198 // CHECK-NEXT: entry:
199 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 12)
200 // CHECK-NEXT: ret i64 [[TMP0]]
202 // CPP-CHECK-LABEL: @_Z18test_svcntw_pat_12v(
203 // CPP-CHECK-NEXT: entry:
204 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 12)
205 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
207 uint64_t test_svcntw_pat_12()
209 return svcntw_pat(SV_VL128
);
212 // CHECK-LABEL: @test_svcntw_pat_13(
213 // CHECK-NEXT: entry:
214 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 13)
215 // CHECK-NEXT: ret i64 [[TMP0]]
217 // CPP-CHECK-LABEL: @_Z18test_svcntw_pat_13v(
218 // CPP-CHECK-NEXT: entry:
219 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 13)
220 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
222 uint64_t test_svcntw_pat_13()
224 return svcntw_pat(SV_VL256
);
227 // CHECK-LABEL: @test_svcntw_pat_14(
228 // CHECK-NEXT: entry:
229 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 29)
230 // CHECK-NEXT: ret i64 [[TMP0]]
232 // CPP-CHECK-LABEL: @_Z18test_svcntw_pat_14v(
233 // CPP-CHECK-NEXT: entry:
234 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 29)
235 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
237 uint64_t test_svcntw_pat_14()
239 return svcntw_pat(SV_MUL4
);
242 // CHECK-LABEL: @test_svcntw_pat_15(
243 // CHECK-NEXT: entry:
244 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 30)
245 // CHECK-NEXT: ret i64 [[TMP0]]
247 // CPP-CHECK-LABEL: @_Z18test_svcntw_pat_15v(
248 // CPP-CHECK-NEXT: entry:
249 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntw(i32 30)
250 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
252 uint64_t test_svcntw_pat_15()
254 return svcntw_pat(SV_MUL3
);
257 // CHECK-LABEL: @test_svcntw_pat_16(
258 // CHECK-NEXT: entry:
259 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.vscale.i64()
260 // CHECK-NEXT: [[TMP1:%.*]] = shl nuw nsw i64 [[TMP0]], 2
261 // CHECK-NEXT: ret i64 [[TMP1]]
263 // CPP-CHECK-LABEL: @_Z18test_svcntw_pat_16v(
264 // CPP-CHECK-NEXT: entry:
265 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.vscale.i64()
266 // CPP-CHECK-NEXT: [[TMP1:%.*]] = shl nuw nsw i64 [[TMP0]], 2
267 // CPP-CHECK-NEXT: ret i64 [[TMP1]]
269 uint64_t test_svcntw_pat_16()
271 return svcntw_pat(SV_ALL
);