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_svcntb(
18 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.vscale.i64()
19 // CHECK-NEXT: [[TMP1:%.*]] = shl nuw nsw i64 [[TMP0]], 4
20 // CHECK-NEXT: ret i64 [[TMP1]]
22 // CPP-CHECK-LABEL: @_Z11test_svcntbv(
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]], 4
26 // CPP-CHECK-NEXT: ret i64 [[TMP1]]
28 uint64_t test_svcntb(void) MODE_ATTR
33 // CHECK-LABEL: @test_svcntb_pat(
35 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntb(i32 0)
36 // CHECK-NEXT: ret i64 [[TMP0]]
38 // CPP-CHECK-LABEL: @_Z15test_svcntb_patv(
39 // CPP-CHECK-NEXT: entry:
40 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntb(i32 0)
41 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
43 uint64_t test_svcntb_pat(void) MODE_ATTR
45 return svcntb_pat(SV_POW2
);
48 // CHECK-LABEL: @test_svcntb_pat_1(
50 // CHECK-NEXT: ret i64 1
52 // CPP-CHECK-LABEL: @_Z17test_svcntb_pat_1v(
53 // CPP-CHECK-NEXT: entry:
54 // CPP-CHECK-NEXT: ret i64 1
56 uint64_t test_svcntb_pat_1(void) MODE_ATTR
58 return svcntb_pat(SV_VL1
);
61 // CHECK-LABEL: @test_svcntb_pat_2(
63 // CHECK-NEXT: ret i64 2
65 // CPP-CHECK-LABEL: @_Z17test_svcntb_pat_2v(
66 // CPP-CHECK-NEXT: entry:
67 // CPP-CHECK-NEXT: ret i64 2
69 uint64_t test_svcntb_pat_2(void) MODE_ATTR
71 return svcntb_pat(SV_VL2
);
74 // CHECK-LABEL: @test_svcntb_pat_3(
76 // CHECK-NEXT: ret i64 3
78 // CPP-CHECK-LABEL: @_Z17test_svcntb_pat_3v(
79 // CPP-CHECK-NEXT: entry:
80 // CPP-CHECK-NEXT: ret i64 3
82 uint64_t test_svcntb_pat_3(void) MODE_ATTR
84 return svcntb_pat(SV_VL3
);
87 // CHECK-LABEL: @test_svcntb_pat_4(
89 // CHECK-NEXT: ret i64 4
91 // CPP-CHECK-LABEL: @_Z17test_svcntb_pat_4v(
92 // CPP-CHECK-NEXT: entry:
93 // CPP-CHECK-NEXT: ret i64 4
95 uint64_t test_svcntb_pat_4(void) MODE_ATTR
97 return svcntb_pat(SV_VL4
);
100 // CHECK-LABEL: @test_svcntb_pat_5(
101 // CHECK-NEXT: entry:
102 // CHECK-NEXT: ret i64 5
104 // CPP-CHECK-LABEL: @_Z17test_svcntb_pat_5v(
105 // CPP-CHECK-NEXT: entry:
106 // CPP-CHECK-NEXT: ret i64 5
108 uint64_t test_svcntb_pat_5(void) MODE_ATTR
110 return svcntb_pat(SV_VL5
);
113 // CHECK-LABEL: @test_svcntb_pat_6(
114 // CHECK-NEXT: entry:
115 // CHECK-NEXT: ret i64 6
117 // CPP-CHECK-LABEL: @_Z17test_svcntb_pat_6v(
118 // CPP-CHECK-NEXT: entry:
119 // CPP-CHECK-NEXT: ret i64 6
121 uint64_t test_svcntb_pat_6(void) MODE_ATTR
123 return svcntb_pat(SV_VL6
);
126 // CHECK-LABEL: @test_svcntb_pat_7(
127 // CHECK-NEXT: entry:
128 // CHECK-NEXT: ret i64 7
130 // CPP-CHECK-LABEL: @_Z17test_svcntb_pat_7v(
131 // CPP-CHECK-NEXT: entry:
132 // CPP-CHECK-NEXT: ret i64 7
134 uint64_t test_svcntb_pat_7(void) MODE_ATTR
136 return svcntb_pat(SV_VL7
);
139 // CHECK-LABEL: @test_svcntb_pat_8(
140 // CHECK-NEXT: entry:
141 // CHECK-NEXT: ret i64 8
143 // CPP-CHECK-LABEL: @_Z17test_svcntb_pat_8v(
144 // CPP-CHECK-NEXT: entry:
145 // CPP-CHECK-NEXT: ret i64 8
147 uint64_t test_svcntb_pat_8(void) MODE_ATTR
149 return svcntb_pat(SV_VL8
);
152 // CHECK-LABEL: @test_svcntb_pat_9(
153 // CHECK-NEXT: entry:
154 // CHECK-NEXT: ret i64 16
156 // CPP-CHECK-LABEL: @_Z17test_svcntb_pat_9v(
157 // CPP-CHECK-NEXT: entry:
158 // CPP-CHECK-NEXT: ret i64 16
160 uint64_t test_svcntb_pat_9(void) MODE_ATTR
162 return svcntb_pat(SV_VL16
);
165 // CHECK-LABEL: @test_svcntb_pat_10(
166 // CHECK-NEXT: entry:
167 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntb(i32 10)
168 // CHECK-NEXT: ret i64 [[TMP0]]
170 // CPP-CHECK-LABEL: @_Z18test_svcntb_pat_10v(
171 // CPP-CHECK-NEXT: entry:
172 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntb(i32 10)
173 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
175 uint64_t test_svcntb_pat_10(void) MODE_ATTR
177 return svcntb_pat(SV_VL32
);
180 // CHECK-LABEL: @test_svcntb_pat_11(
181 // CHECK-NEXT: entry:
182 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntb(i32 11)
183 // CHECK-NEXT: ret i64 [[TMP0]]
185 // CPP-CHECK-LABEL: @_Z18test_svcntb_pat_11v(
186 // CPP-CHECK-NEXT: entry:
187 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntb(i32 11)
188 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
190 uint64_t test_svcntb_pat_11(void) MODE_ATTR
192 return svcntb_pat(SV_VL64
);
195 // CHECK-LABEL: @test_svcntb_pat_12(
196 // CHECK-NEXT: entry:
197 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntb(i32 12)
198 // CHECK-NEXT: ret i64 [[TMP0]]
200 // CPP-CHECK-LABEL: @_Z18test_svcntb_pat_12v(
201 // CPP-CHECK-NEXT: entry:
202 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntb(i32 12)
203 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
205 uint64_t test_svcntb_pat_12(void) MODE_ATTR
207 return svcntb_pat(SV_VL128
);
210 // CHECK-LABEL: @test_svcntb_pat_13(
211 // CHECK-NEXT: entry:
212 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntb(i32 13)
213 // CHECK-NEXT: ret i64 [[TMP0]]
215 // CPP-CHECK-LABEL: @_Z18test_svcntb_pat_13v(
216 // CPP-CHECK-NEXT: entry:
217 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntb(i32 13)
218 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
220 uint64_t test_svcntb_pat_13(void) MODE_ATTR
222 return svcntb_pat(SV_VL256
);
225 // CHECK-LABEL: @test_svcntb_pat_14(
226 // CHECK-NEXT: entry:
227 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntb(i32 29)
228 // CHECK-NEXT: ret i64 [[TMP0]]
230 // CPP-CHECK-LABEL: @_Z18test_svcntb_pat_14v(
231 // CPP-CHECK-NEXT: entry:
232 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntb(i32 29)
233 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
235 uint64_t test_svcntb_pat_14(void) MODE_ATTR
237 return svcntb_pat(SV_MUL4
);
240 // CHECK-LABEL: @test_svcntb_pat_15(
241 // CHECK-NEXT: entry:
242 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntb(i32 30)
243 // CHECK-NEXT: ret i64 [[TMP0]]
245 // CPP-CHECK-LABEL: @_Z18test_svcntb_pat_15v(
246 // CPP-CHECK-NEXT: entry:
247 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.aarch64.sve.cntb(i32 30)
248 // CPP-CHECK-NEXT: ret i64 [[TMP0]]
250 uint64_t test_svcntb_pat_15(void) MODE_ATTR
252 return svcntb_pat(SV_MUL3
);
255 // CHECK-LABEL: @test_svcntb_pat_16(
256 // CHECK-NEXT: entry:
257 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.vscale.i64()
258 // CHECK-NEXT: [[TMP1:%.*]] = shl nuw nsw i64 [[TMP0]], 4
259 // CHECK-NEXT: ret i64 [[TMP1]]
261 // CPP-CHECK-LABEL: @_Z18test_svcntb_pat_16v(
262 // CPP-CHECK-NEXT: entry:
263 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.vscale.i64()
264 // CPP-CHECK-NEXT: [[TMP1:%.*]] = shl nuw nsw i64 [[TMP0]], 4
265 // CPP-CHECK-NEXT: ret i64 [[TMP1]]
267 uint64_t test_svcntb_pat_16(void) MODE_ATTR
269 return svcntb_pat(SV_ALL
);