1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // REQUIRES: aarch64-registered-target
3 // RUN: %clang_cc1 -triple aarch64 -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,instcombine,tailcallelim | FileCheck %s
4 // RUN: %clang_cc1 -triple aarch64 -target-feature +sve -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 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
6 // RUN: %clang_cc1 -triple aarch64 -target-feature +sme -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
10 #if defined __ARM_FEATURE_SME
11 #define MODE_ATTR __arm_streaming
16 // CHECK-LABEL: @test_svcntd(
18 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.vscale.i64()
19 // CHECK-NEXT: [[TMP1:%.*]] = shl nuw nsw i64 [[TMP0]], 1
20 // CHECK-NEXT: ret i64 [[TMP1]]
22 // CPP-CHECK-LABEL: @_Z11test_svcntdv(
23 // CPP-CHECK-NEXT: entry:
24 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.vscale.i64()
25 // CPP-CHECK-NEXT: [[TMP1:%.*]] = shl nuw nsw i64 [[TMP0]], 1
26 // CPP-CHECK-NEXT: ret i64 [[TMP1]]
28 uint64_t test_svcntd(void) MODE_ATTR
33 // CHECK-LABEL: @test_svcntd_pat(
35 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 0)
36 // CHECK-NEXT: ret i64 [[TMP0]]
38 // CPP-CHECK-LABEL: @_Z15test_svcntd_patv(
39 // CPP-CHECK-NEXT: entry:
40 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 0)
41 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
43 uint64_t test_svcntd_pat(void) MODE_ATTR
45 return svcntd_pat(SV_POW2
);
48 // CHECK-LABEL: @test_svcntd_pat_1(
50 // CHECK-NEXT: ret i64 1
52 // CPP-CHECK-LABEL: @_Z17test_svcntd_pat_1v(
53 // CPP-CHECK-NEXT: entry:
54 // CPP-CHECK-NEXT: ret i64 1
56 uint64_t test_svcntd_pat_1(void) MODE_ATTR
58 return svcntd_pat(SV_VL1
);
61 // CHECK-LABEL: @test_svcntd_pat_2(
63 // CHECK-NEXT: ret i64 2
65 // CPP-CHECK-LABEL: @_Z17test_svcntd_pat_2v(
66 // CPP-CHECK-NEXT: entry:
67 // CPP-CHECK-NEXT: ret i64 2
69 uint64_t test_svcntd_pat_2(void) MODE_ATTR
71 return svcntd_pat(SV_VL2
);
74 // CHECK-LABEL: @test_svcntd_pat_3(
76 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 3)
77 // CHECK-NEXT: ret i64 [[TMP0]]
79 // CPP-CHECK-LABEL: @_Z17test_svcntd_pat_3v(
80 // CPP-CHECK-NEXT: entry:
81 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 3)
82 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
84 uint64_t test_svcntd_pat_3(void) MODE_ATTR
86 return svcntd_pat(SV_VL3
);
89 // CHECK-LABEL: @test_svcntd_pat_4(
91 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 4)
92 // CHECK-NEXT: ret i64 [[TMP0]]
94 // CPP-CHECK-LABEL: @_Z17test_svcntd_pat_4v(
95 // CPP-CHECK-NEXT: entry:
96 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 4)
97 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
99 uint64_t test_svcntd_pat_4(void) MODE_ATTR
101 return svcntd_pat(SV_VL4
);
104 // CHECK-LABEL: @test_svcntd_pat_5(
105 // CHECK-NEXT: entry:
106 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 5)
107 // CHECK-NEXT: ret i64 [[TMP0]]
109 // CPP-CHECK-LABEL: @_Z17test_svcntd_pat_5v(
110 // CPP-CHECK-NEXT: entry:
111 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 5)
112 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
114 uint64_t test_svcntd_pat_5(void) MODE_ATTR
116 return svcntd_pat(SV_VL5
);
119 // CHECK-LABEL: @test_svcntd_pat_6(
120 // CHECK-NEXT: entry:
121 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 6)
122 // CHECK-NEXT: ret i64 [[TMP0]]
124 // CPP-CHECK-LABEL: @_Z17test_svcntd_pat_6v(
125 // CPP-CHECK-NEXT: entry:
126 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 6)
127 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
129 uint64_t test_svcntd_pat_6(void) MODE_ATTR
131 return svcntd_pat(SV_VL6
);
134 // CHECK-LABEL: @test_svcntd_pat_7(
135 // CHECK-NEXT: entry:
136 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 7)
137 // CHECK-NEXT: ret i64 [[TMP0]]
139 // CPP-CHECK-LABEL: @_Z17test_svcntd_pat_7v(
140 // CPP-CHECK-NEXT: entry:
141 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 7)
142 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
144 uint64_t test_svcntd_pat_7(void) MODE_ATTR
146 return svcntd_pat(SV_VL7
);
149 // CHECK-LABEL: @test_svcntd_pat_8(
150 // CHECK-NEXT: entry:
151 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 8)
152 // CHECK-NEXT: ret i64 [[TMP0]]
154 // CPP-CHECK-LABEL: @_Z17test_svcntd_pat_8v(
155 // CPP-CHECK-NEXT: entry:
156 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 8)
157 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
159 uint64_t test_svcntd_pat_8(void) MODE_ATTR
161 return svcntd_pat(SV_VL8
);
164 // CHECK-LABEL: @test_svcntd_pat_9(
165 // CHECK-NEXT: entry:
166 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 9)
167 // CHECK-NEXT: ret i64 [[TMP0]]
169 // CPP-CHECK-LABEL: @_Z17test_svcntd_pat_9v(
170 // CPP-CHECK-NEXT: entry:
171 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 9)
172 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
174 uint64_t test_svcntd_pat_9(void) MODE_ATTR
176 return svcntd_pat(SV_VL16
);
179 // CHECK-LABEL: @test_svcntd_pat_10(
180 // CHECK-NEXT: entry:
181 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 10)
182 // CHECK-NEXT: ret i64 [[TMP0]]
184 // CPP-CHECK-LABEL: @_Z18test_svcntd_pat_10v(
185 // CPP-CHECK-NEXT: entry:
186 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 10)
187 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
189 uint64_t test_svcntd_pat_10(void) MODE_ATTR
191 return svcntd_pat(SV_VL32
);
194 // CHECK-LABEL: @test_svcntd_pat_11(
195 // CHECK-NEXT: entry:
196 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 11)
197 // CHECK-NEXT: ret i64 [[TMP0]]
199 // CPP-CHECK-LABEL: @_Z18test_svcntd_pat_11v(
200 // CPP-CHECK-NEXT: entry:
201 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 11)
202 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
204 uint64_t test_svcntd_pat_11(void) MODE_ATTR
206 return svcntd_pat(SV_VL64
);
209 // CHECK-LABEL: @test_svcntd_pat_12(
210 // CHECK-NEXT: entry:
211 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 12)
212 // CHECK-NEXT: ret i64 [[TMP0]]
214 // CPP-CHECK-LABEL: @_Z18test_svcntd_pat_12v(
215 // CPP-CHECK-NEXT: entry:
216 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 12)
217 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
219 uint64_t test_svcntd_pat_12(void) MODE_ATTR
221 return svcntd_pat(SV_VL128
);
224 // CHECK-LABEL: @test_svcntd_pat_13(
225 // CHECK-NEXT: entry:
226 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 13)
227 // CHECK-NEXT: ret i64 [[TMP0]]
229 // CPP-CHECK-LABEL: @_Z18test_svcntd_pat_13v(
230 // CPP-CHECK-NEXT: entry:
231 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 13)
232 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
234 uint64_t test_svcntd_pat_13(void) MODE_ATTR
236 return svcntd_pat(SV_VL256
);
239 // CHECK-LABEL: @test_svcntd_pat_14(
240 // CHECK-NEXT: entry:
241 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 29)
242 // CHECK-NEXT: ret i64 [[TMP0]]
244 // CPP-CHECK-LABEL: @_Z18test_svcntd_pat_14v(
245 // CPP-CHECK-NEXT: entry:
246 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 29)
247 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
249 uint64_t test_svcntd_pat_14(void) MODE_ATTR
251 return svcntd_pat(SV_MUL4
);
254 // CHECK-LABEL: @test_svcntd_pat_15(
255 // CHECK-NEXT: entry:
256 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 30)
257 // CHECK-NEXT: ret i64 [[TMP0]]
259 // CPP-CHECK-LABEL: @_Z18test_svcntd_pat_15v(
260 // CPP-CHECK-NEXT: entry:
261 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntd(i32 30)
262 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
264 uint64_t test_svcntd_pat_15(void) MODE_ATTR
266 return svcntd_pat(SV_MUL3
);
269 // CHECK-LABEL: @test_svcntd_pat_16(
270 // CHECK-NEXT: entry:
271 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.vscale.i64()
272 // CHECK-NEXT: [[TMP1:%.*]] = shl nuw nsw i64 [[TMP0]], 1
273 // CHECK-NEXT: ret i64 [[TMP1]]
275 // CPP-CHECK-LABEL: @_Z18test_svcntd_pat_16v(
276 // CPP-CHECK-NEXT: entry:
277 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.vscale.i64()
278 // CPP-CHECK-NEXT: [[TMP1:%.*]] = shl nuw nsw i64 [[TMP0]], 1
279 // CPP-CHECK-NEXT: ret i64 [[TMP1]]
281 uint64_t test_svcntd_pat_16(void) MODE_ATTR
283 return svcntd_pat(SV_ALL
);