comparison clang/test/CodeGen/builtins-ppc-crypto.c @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children
comparison
equal deleted inserted replaced
173:0572611fdcc8 207:2e18cbf3894f
22 #define D_INIT1 { 0x0102030405060708, \ 22 #define D_INIT1 { 0x0102030405060708, \
23 0x090A0B0C0D0E0F10 }; 23 0x090A0B0C0D0E0F10 };
24 #define D_INIT2 { 0x7172737475767778, \ 24 #define D_INIT2 { 0x7172737475767778, \
25 0x797A7B7C7D7E7F70 }; 25 0x797A7B7C7D7E7F70 };
26 26
27 // CHECK-LABEL: define <16 x i8> @test_vpmsumb 27 // CHECK-LABEL: define{{.*}} <16 x i8> @test_vpmsumb
28 vector unsigned char test_vpmsumb(void) 28 vector unsigned char test_vpmsumb(void)
29 { 29 {
30 vector unsigned char a = B_INIT1 30 vector unsigned char a = B_INIT1
31 vector unsigned char b = B_INIT2 31 vector unsigned char b = B_INIT2
32 return __builtin_altivec_crypto_vpmsumb(a, b); 32 return __builtin_altivec_crypto_vpmsumb(a, b);
33 // CHECK: @llvm.ppc.altivec.crypto.vpmsumb 33 // CHECK: @llvm.ppc.altivec.crypto.vpmsumb
34 } 34 }
35 35
36 // CHECK-LABEL: define <8 x i16> @test_vpmsumh 36 // CHECK-LABEL: define{{.*}} <8 x i16> @test_vpmsumh
37 vector unsigned short test_vpmsumh(void) 37 vector unsigned short test_vpmsumh(void)
38 { 38 {
39 vector unsigned short a = H_INIT1 39 vector unsigned short a = H_INIT1
40 vector unsigned short b = H_INIT2 40 vector unsigned short b = H_INIT2
41 return __builtin_altivec_crypto_vpmsumh(a, b); 41 return __builtin_altivec_crypto_vpmsumh(a, b);
42 // CHECK: @llvm.ppc.altivec.crypto.vpmsumh 42 // CHECK: @llvm.ppc.altivec.crypto.vpmsumh
43 } 43 }
44 44
45 // CHECK-LABEL: define <4 x i32> @test_vpmsumw 45 // CHECK-LABEL: define{{.*}} <4 x i32> @test_vpmsumw
46 vector unsigned int test_vpmsumw(void) 46 vector unsigned int test_vpmsumw(void)
47 { 47 {
48 vector unsigned int a = W_INIT1 48 vector unsigned int a = W_INIT1
49 vector unsigned int b = W_INIT2 49 vector unsigned int b = W_INIT2
50 return __builtin_altivec_crypto_vpmsumw(a, b); 50 return __builtin_altivec_crypto_vpmsumw(a, b);
51 // CHECK: @llvm.ppc.altivec.crypto.vpmsumw 51 // CHECK: @llvm.ppc.altivec.crypto.vpmsumw
52 } 52 }
53 53
54 // CHECK-LABEL: define <2 x i64> @test_vpmsumd 54 // CHECK-LABEL: define{{.*}} <2 x i64> @test_vpmsumd
55 vector unsigned long long test_vpmsumd(void) 55 vector unsigned long long test_vpmsumd(void)
56 { 56 {
57 vector unsigned long long a = D_INIT1 57 vector unsigned long long a = D_INIT1
58 vector unsigned long long b = D_INIT2 58 vector unsigned long long b = D_INIT2
59 return __builtin_altivec_crypto_vpmsumd(a, b); 59 return __builtin_altivec_crypto_vpmsumd(a, b);
60 // CHECK: @llvm.ppc.altivec.crypto.vpmsumd 60 // CHECK: @llvm.ppc.altivec.crypto.vpmsumd
61 } 61 }
62 62
63 // CHECK-LABEL: define <2 x i64> @test_vsbox 63 // CHECK-LABEL: define{{.*}} <2 x i64> @test_vsbox
64 vector unsigned long long test_vsbox(void) 64 vector unsigned long long test_vsbox(void)
65 { 65 {
66 vector unsigned long long a = D_INIT1 66 vector unsigned long long a = D_INIT1
67 return __builtin_altivec_crypto_vsbox(a); 67 return __builtin_altivec_crypto_vsbox(a);
68 // CHECK: @llvm.ppc.altivec.crypto.vsbox 68 // CHECK: @llvm.ppc.altivec.crypto.vsbox
69 } 69 }
70 70
71 // CHECK-LABEL: define <16 x i8> @test_vpermxorb 71 // CHECK-LABEL: define{{.*}} <16 x i8> @test_vpermxorb
72 vector unsigned char test_vpermxorb(void) 72 vector unsigned char test_vpermxorb(void)
73 { 73 {
74 vector unsigned char a = B_INIT1 74 vector unsigned char a = B_INIT1
75 vector unsigned char b = B_INIT2 75 vector unsigned char b = B_INIT2
76 vector unsigned char c = B_INIT2 76 vector unsigned char c = B_INIT2
77 return __builtin_altivec_crypto_vpermxor(a, b, c); 77 return __builtin_altivec_crypto_vpermxor(a, b, c);
78 // CHECK: @llvm.ppc.altivec.crypto.vpermxor 78 // CHECK: @llvm.ppc.altivec.crypto.vpermxor
79 } 79 }
80 80
81 // CHECK-LABEL: define <8 x i16> @test_vpermxorh 81 // CHECK-LABEL: define{{.*}} <8 x i16> @test_vpermxorh
82 vector unsigned short test_vpermxorh(void) 82 vector unsigned short test_vpermxorh(void)
83 { 83 {
84 vector unsigned short a = H_INIT1 84 vector unsigned short a = H_INIT1
85 vector unsigned short b = H_INIT2 85 vector unsigned short b = H_INIT2
86 vector unsigned short c = H_INIT2 86 vector unsigned short c = H_INIT2
87 return __builtin_altivec_crypto_vpermxor(a, b, c); 87 return __builtin_altivec_crypto_vpermxor(a, b, c);
88 // CHECK: @llvm.ppc.altivec.crypto.vpermxor 88 // CHECK: @llvm.ppc.altivec.crypto.vpermxor
89 } 89 }
90 90
91 // CHECK-LABEL: define <4 x i32> @test_vpermxorw 91 // CHECK-LABEL: define{{.*}} <4 x i32> @test_vpermxorw
92 vector unsigned int test_vpermxorw(void) 92 vector unsigned int test_vpermxorw(void)
93 { 93 {
94 vector unsigned int a = W_INIT1 94 vector unsigned int a = W_INIT1
95 vector unsigned int b = W_INIT2 95 vector unsigned int b = W_INIT2
96 vector unsigned int c = W_INIT2 96 vector unsigned int c = W_INIT2
97 return __builtin_altivec_crypto_vpermxor(a, b, c); 97 return __builtin_altivec_crypto_vpermxor(a, b, c);
98 // CHECK: @llvm.ppc.altivec.crypto.vpermxor 98 // CHECK: @llvm.ppc.altivec.crypto.vpermxor
99 } 99 }
100 100
101 // CHECK-LABEL: define <2 x i64> @test_vpermxord 101 // CHECK-LABEL: define{{.*}} <2 x i64> @test_vpermxord
102 vector unsigned long long test_vpermxord(void) 102 vector unsigned long long test_vpermxord(void)
103 { 103 {
104 vector unsigned long long a = D_INIT1 104 vector unsigned long long a = D_INIT1
105 vector unsigned long long b = D_INIT2 105 vector unsigned long long b = D_INIT2
106 vector unsigned long long c = D_INIT2 106 vector unsigned long long c = D_INIT2
130 vector unsigned char c) { 130 vector unsigned char c) {
131 return vec_permxor(a, b, c); 131 return vec_permxor(a, b, c);
132 // CHECK: @llvm.ppc.altivec.crypto.vpermxor 132 // CHECK: @llvm.ppc.altivec.crypto.vpermxor
133 } 133 }
134 134
135 // CHECK-LABEL: define <2 x i64> @test_vcipher 135 // CHECK-LABEL: define{{.*}} <2 x i64> @test_vcipher
136 vector unsigned long long test_vcipher(void) 136 vector unsigned long long test_vcipher(void)
137 { 137 {
138 vector unsigned long long a = D_INIT1 138 vector unsigned long long a = D_INIT1
139 vector unsigned long long b = D_INIT2 139 vector unsigned long long b = D_INIT2
140 return __builtin_altivec_crypto_vcipher(a, b); 140 return __builtin_altivec_crypto_vcipher(a, b);
141 // CHECK: @llvm.ppc.altivec.crypto.vcipher 141 // CHECK: @llvm.ppc.altivec.crypto.vcipher
142 } 142 }
143 143
144 // CHECK-LABEL: define <2 x i64> @test_vcipherlast 144 // CHECK-LABEL: define{{.*}} <2 x i64> @test_vcipherlast
145 vector unsigned long long test_vcipherlast(void) 145 vector unsigned long long test_vcipherlast(void)
146 { 146 {
147 vector unsigned long long a = D_INIT1 147 vector unsigned long long a = D_INIT1
148 vector unsigned long long b = D_INIT2 148 vector unsigned long long b = D_INIT2
149 return __builtin_altivec_crypto_vcipherlast(a, b); 149 return __builtin_altivec_crypto_vcipherlast(a, b);
157 vector unsigned long long b = D_INIT2 157 vector unsigned long long b = D_INIT2
158 return __builtin_altivec_crypto_vncipher(a, b); 158 return __builtin_altivec_crypto_vncipher(a, b);
159 // CHECK: @llvm.ppc.altivec.crypto.vncipher 159 // CHECK: @llvm.ppc.altivec.crypto.vncipher
160 } 160 }
161 161
162 // CHECK-LABEL: define <2 x i64> @test_vncipherlast 162 // CHECK-LABEL: define{{.*}} <2 x i64> @test_vncipherlast
163 vector unsigned long long test_vncipherlast(void) 163 vector unsigned long long test_vncipherlast(void)
164 { 164 {
165 vector unsigned long long a = D_INIT1 165 vector unsigned long long a = D_INIT1
166 vector unsigned long long b = D_INIT2 166 vector unsigned long long b = D_INIT2
167 return __builtin_altivec_crypto_vncipherlast(a, b); 167 return __builtin_altivec_crypto_vncipherlast(a, b);
168 // CHECK: @llvm.ppc.altivec.crypto.vncipherlast 168 // CHECK: @llvm.ppc.altivec.crypto.vncipherlast
169 } 169 }
170 170
171 // CHECK-LABEL: define <4 x i32> @test_vshasigmaw 171 // CHECK-LABEL: define{{.*}} <4 x i32> @test_vshasigmaw
172 vector unsigned int test_vshasigmaw(void) 172 vector unsigned int test_vshasigmaw(void)
173 { 173 {
174 vector unsigned int a = W_INIT1 174 vector unsigned int a = W_INIT1
175 return __builtin_altivec_crypto_vshasigmaw(a, 1, 15); 175 return __builtin_altivec_crypto_vshasigmaw(a, 1, 15);
176 // CHECK: @llvm.ppc.altivec.crypto.vshasigmaw 176 // CHECK: @llvm.ppc.altivec.crypto.vshasigmaw
177 } 177 }
178 178
179 // CHECK-LABEL: define <2 x i64> @test_vshasigmad 179 // CHECK-LABEL: define{{.*}} <2 x i64> @test_vshasigmad
180 vector unsigned long long test_vshasigmad(void) 180 vector unsigned long long test_vshasigmad(void)
181 { 181 {
182 vector unsigned long long a = D_INIT2 182 vector unsigned long long a = D_INIT2
183 return __builtin_altivec_crypto_vshasigmad(a, 1, 15); 183 return __builtin_altivec_crypto_vshasigmad(a, 1, 15);
184 // CHECK: @llvm.ppc.altivec.crypto.vshasigmad 184 // CHECK: @llvm.ppc.altivec.crypto.vshasigmad
185 } 185 }
186 186
187 // Test cases for the builtins the way they are exposed to 187 // Test cases for the builtins the way they are exposed to
188 // users through altivec.h 188 // users through altivec.h
189 // CHECK-LABEL: define <16 x i8> @test_vpmsumb_e 189 // CHECK-LABEL: define{{.*}} <16 x i8> @test_vpmsumb_e
190 vector unsigned char test_vpmsumb_e(void) 190 vector unsigned char test_vpmsumb_e(void)
191 { 191 {
192 vector unsigned char a = B_INIT1 192 vector unsigned char a = B_INIT1
193 vector unsigned char b = B_INIT2 193 vector unsigned char b = B_INIT2
194 return __builtin_crypto_vpmsumb(a, b); 194 return __builtin_crypto_vpmsumb(a, b);
195 // CHECK: @llvm.ppc.altivec.crypto.vpmsumb 195 // CHECK: @llvm.ppc.altivec.crypto.vpmsumb
196 } 196 }
197 197
198 // CHECK-LABEL: define <8 x i16> @test_vpmsumh_e 198 // CHECK-LABEL: define{{.*}} <8 x i16> @test_vpmsumh_e
199 vector unsigned short test_vpmsumh_e(void) 199 vector unsigned short test_vpmsumh_e(void)
200 { 200 {
201 vector unsigned short a = H_INIT1 201 vector unsigned short a = H_INIT1
202 vector unsigned short b = H_INIT2 202 vector unsigned short b = H_INIT2
203 return __builtin_crypto_vpmsumb(a, b); 203 return __builtin_crypto_vpmsumb(a, b);
204 // CHECK: @llvm.ppc.altivec.crypto.vpmsumh 204 // CHECK: @llvm.ppc.altivec.crypto.vpmsumh
205 } 205 }
206 206
207 // CHECK-LABEL: define <4 x i32> @test_vpmsumw_e 207 // CHECK-LABEL: define{{.*}} <4 x i32> @test_vpmsumw_e
208 vector unsigned int test_vpmsumw_e(void) 208 vector unsigned int test_vpmsumw_e(void)
209 { 209 {
210 vector unsigned int a = W_INIT1 210 vector unsigned int a = W_INIT1
211 vector unsigned int b = W_INIT2 211 vector unsigned int b = W_INIT2
212 return __builtin_crypto_vpmsumb(a, b); 212 return __builtin_crypto_vpmsumb(a, b);
213 // CHECK: @llvm.ppc.altivec.crypto.vpmsumw 213 // CHECK: @llvm.ppc.altivec.crypto.vpmsumw
214 } 214 }
215 215
216 // CHECK-LABEL: define <2 x i64> @test_vpmsumd_e 216 // CHECK-LABEL: define{{.*}} <2 x i64> @test_vpmsumd_e
217 vector unsigned long long test_vpmsumd_e(void) 217 vector unsigned long long test_vpmsumd_e(void)
218 { 218 {
219 vector unsigned long long a = D_INIT1 219 vector unsigned long long a = D_INIT1
220 vector unsigned long long b = D_INIT2 220 vector unsigned long long b = D_INIT2
221 return __builtin_crypto_vpmsumb(a, b); 221 return __builtin_crypto_vpmsumb(a, b);
222 // CHECK: @llvm.ppc.altivec.crypto.vpmsumd 222 // CHECK: @llvm.ppc.altivec.crypto.vpmsumd
223 } 223 }
224 224
225 // CHECK-LABEL: define <2 x i64> @test_vsbox_e 225 // CHECK-LABEL: define{{.*}} <2 x i64> @test_vsbox_e
226 vector unsigned long long test_vsbox_e(void) 226 vector unsigned long long test_vsbox_e(void)
227 { 227 {
228 vector unsigned long long a = D_INIT1 228 vector unsigned long long a = D_INIT1
229 return __builtin_crypto_vsbox(a); 229 return __builtin_crypto_vsbox(a);
230 // CHECK: @llvm.ppc.altivec.crypto.vsbox 230 // CHECK: @llvm.ppc.altivec.crypto.vsbox
231 } 231 }
232 232
233 // CHECK-LABEL: define <16 x i8> @test_vpermxorb_e 233 // CHECK-LABEL: define{{.*}} <16 x i8> @test_vpermxorb_e
234 vector unsigned char test_vpermxorb_e(void) 234 vector unsigned char test_vpermxorb_e(void)
235 { 235 {
236 vector unsigned char a = B_INIT1 236 vector unsigned char a = B_INIT1
237 vector unsigned char b = B_INIT2 237 vector unsigned char b = B_INIT2
238 vector unsigned char c = B_INIT2 238 vector unsigned char c = B_INIT2
239 return __builtin_crypto_vpermxor(a, b, c); 239 return __builtin_crypto_vpermxor(a, b, c);
240 // CHECK: @llvm.ppc.altivec.crypto.vpermxor 240 // CHECK: @llvm.ppc.altivec.crypto.vpermxor
241 } 241 }
242 242
243 // CHECK-LABEL: define <8 x i16> @test_vpermxorh_e 243 // CHECK-LABEL: define{{.*}} <8 x i16> @test_vpermxorh_e
244 vector unsigned short test_vpermxorh_e(void) 244 vector unsigned short test_vpermxorh_e(void)
245 { 245 {
246 vector unsigned short a = H_INIT1 246 vector unsigned short a = H_INIT1
247 vector unsigned short b = H_INIT2 247 vector unsigned short b = H_INIT2
248 vector unsigned short c = H_INIT2 248 vector unsigned short c = H_INIT2
249 return __builtin_crypto_vpermxor(a, b, c); 249 return __builtin_crypto_vpermxor(a, b, c);
250 // CHECK: @llvm.ppc.altivec.crypto.vpermxor 250 // CHECK: @llvm.ppc.altivec.crypto.vpermxor
251 } 251 }
252 252
253 // CHECK-LABEL: define <4 x i32> @test_vpermxorw_e 253 // CHECK-LABEL: define{{.*}} <4 x i32> @test_vpermxorw_e
254 vector unsigned int test_vpermxorw_e(void) 254 vector unsigned int test_vpermxorw_e(void)
255 { 255 {
256 vector unsigned int a = W_INIT1 256 vector unsigned int a = W_INIT1
257 vector unsigned int b = W_INIT2 257 vector unsigned int b = W_INIT2
258 vector unsigned int c = W_INIT2 258 vector unsigned int c = W_INIT2
259 return __builtin_crypto_vpermxor(a, b, c); 259 return __builtin_crypto_vpermxor(a, b, c);
260 // CHECK: @llvm.ppc.altivec.crypto.vpermxor 260 // CHECK: @llvm.ppc.altivec.crypto.vpermxor
261 } 261 }
262 262
263 // CHECK-LABEL: define <2 x i64> @test_vpermxord_e 263 // CHECK-LABEL: define{{.*}} <2 x i64> @test_vpermxord_e
264 vector unsigned long long test_vpermxord_e(void) 264 vector unsigned long long test_vpermxord_e(void)
265 { 265 {
266 vector unsigned long long a = D_INIT1 266 vector unsigned long long a = D_INIT1
267 vector unsigned long long b = D_INIT2 267 vector unsigned long long b = D_INIT2
268 vector unsigned long long c = D_INIT2 268 vector unsigned long long c = D_INIT2
269 return __builtin_crypto_vpermxor(a, b, c); 269 return __builtin_crypto_vpermxor(a, b, c);
270 // CHECK: @llvm.ppc.altivec.crypto.vpermxor 270 // CHECK: @llvm.ppc.altivec.crypto.vpermxor
271 } 271 }
272 272
273 // CHECK-LABEL: define <2 x i64> @test_vcipher_e 273 // CHECK-LABEL: define{{.*}} <2 x i64> @test_vcipher_e
274 vector unsigned long long test_vcipher_e(void) 274 vector unsigned long long test_vcipher_e(void)
275 { 275 {
276 vector unsigned long long a = D_INIT1 276 vector unsigned long long a = D_INIT1
277 vector unsigned long long b = D_INIT2 277 vector unsigned long long b = D_INIT2
278 return __builtin_crypto_vcipher(a, b); 278 return __builtin_crypto_vcipher(a, b);
279 // CHECK: @llvm.ppc.altivec.crypto.vcipher 279 // CHECK: @llvm.ppc.altivec.crypto.vcipher
280 } 280 }
281 281
282 // CHECK-LABEL: define <2 x i64> @test_vcipherlast_e 282 // CHECK-LABEL: define{{.*}} <2 x i64> @test_vcipherlast_e
283 vector unsigned long long test_vcipherlast_e(void) 283 vector unsigned long long test_vcipherlast_e(void)
284 { 284 {
285 vector unsigned long long a = D_INIT1 285 vector unsigned long long a = D_INIT1
286 vector unsigned long long b = D_INIT2 286 vector unsigned long long b = D_INIT2
287 return __builtin_crypto_vcipherlast(a, b); 287 return __builtin_crypto_vcipherlast(a, b);
288 // CHECK: @llvm.ppc.altivec.crypto.vcipherlast 288 // CHECK: @llvm.ppc.altivec.crypto.vcipherlast
289 } 289 }
290 290
291 // CHECK-LABEL: define <2 x i64> @test_vncipher_e 291 // CHECK-LABEL: define{{.*}} <2 x i64> @test_vncipher_e
292 vector unsigned long long test_vncipher_e(void) 292 vector unsigned long long test_vncipher_e(void)
293 { 293 {
294 vector unsigned long long a = D_INIT1 294 vector unsigned long long a = D_INIT1
295 vector unsigned long long b = D_INIT2 295 vector unsigned long long b = D_INIT2
296 return __builtin_crypto_vncipher(a, b); 296 return __builtin_crypto_vncipher(a, b);
297 // CHECK: @llvm.ppc.altivec.crypto.vncipher 297 // CHECK: @llvm.ppc.altivec.crypto.vncipher
298 } 298 }
299 299
300 // CHECK-LABEL: define <2 x i64> @test_vncipherlast_e 300 // CHECK-LABEL: define{{.*}} <2 x i64> @test_vncipherlast_e
301 vector unsigned long long test_vncipherlast_e(void) 301 vector unsigned long long test_vncipherlast_e(void)
302 { 302 {
303 vector unsigned long long a = D_INIT1 303 vector unsigned long long a = D_INIT1
304 vector unsigned long long b = D_INIT2 304 vector unsigned long long b = D_INIT2
305 return __builtin_crypto_vncipherlast(a, b); 305 return __builtin_crypto_vncipherlast(a, b);
306 // CHECK: @llvm.ppc.altivec.crypto.vncipherlast 306 // CHECK: @llvm.ppc.altivec.crypto.vncipherlast
307 } 307 }
308 308
309 // CHECK-LABEL: define <4 x i32> @test_vshasigmaw_e 309 // CHECK-LABEL: define{{.*}} <4 x i32> @test_vshasigmaw_e
310 vector unsigned int test_vshasigmaw_e(void) 310 vector unsigned int test_vshasigmaw_e(void)
311 { 311 {
312 vector unsigned int a = W_INIT1 312 vector unsigned int a = W_INIT1
313 return __builtin_crypto_vshasigmaw(a, 1, 15); 313 return __builtin_crypto_vshasigmaw(a, 1, 15);
314 // CHECK: @llvm.ppc.altivec.crypto.vshasigmaw 314 // CHECK: @llvm.ppc.altivec.crypto.vshasigmaw
315 } 315 }
316 316
317 // CHECK-LABEL: define <2 x i64> @test_vshasigmad_e 317 // CHECK-LABEL: define{{.*}} <2 x i64> @test_vshasigmad_e
318 vector unsigned long long test_vshasigmad_e(void) 318 vector unsigned long long test_vshasigmad_e(void)
319 { 319 {
320 vector unsigned long long a = D_INIT2 320 vector unsigned long long a = D_INIT2
321 return __builtin_crypto_vshasigmad(a, 0, 15); 321 return __builtin_crypto_vshasigmad(a, 0, 15);
322 // CHECK: @llvm.ppc.altivec.crypto.vshasigmad 322 // CHECK: @llvm.ppc.altivec.crypto.vshasigmad