Skip to content

Commit 0e2e1fc

Browse files
[PowerPC] Fix types for vcipher builtins.
The documentation specifies that the parameters for the vcipher builtins are ``` vector unsigned char ``` The code used ``` vector unsigned long long ``` This patch fixes the types for the vcipher builtins. Reviewed By: amyk Differential Revision: https://reviews.llvm.org/D135300
1 parent dee9c7f commit 0e2e1fc

File tree

3 files changed

+51
-51
lines changed

3 files changed

+51
-51
lines changed

clang/include/clang/Basic/BuiltinsPPC.def

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,10 @@ BUILTIN(__builtin_altivec_crypto_vpermxor, "V16UcV16UcV16UcV16Uc", "")
423423
BUILTIN(__builtin_altivec_crypto_vpermxor_be, "V16UcV16UcV16UcV16Uc", "")
424424
BUILTIN(__builtin_altivec_crypto_vshasigmaw, "V4UiV4UiIiIi", "")
425425
BUILTIN(__builtin_altivec_crypto_vshasigmad, "V2ULLiV2ULLiIiIi", "")
426-
BUILTIN(__builtin_altivec_crypto_vcipher, "V2ULLiV2ULLiV2ULLi", "")
427-
BUILTIN(__builtin_altivec_crypto_vcipherlast, "V2ULLiV2ULLiV2ULLi", "")
428-
BUILTIN(__builtin_altivec_crypto_vncipher, "V2ULLiV2ULLiV2ULLi", "")
429-
BUILTIN(__builtin_altivec_crypto_vncipherlast, "V2ULLiV2ULLiV2ULLi", "")
426+
BUILTIN(__builtin_altivec_crypto_vcipher, "V16UcV16UcV16Uc", "")
427+
BUILTIN(__builtin_altivec_crypto_vcipherlast, "V16UcV16UcV16Uc", "")
428+
BUILTIN(__builtin_altivec_crypto_vncipher, "V16UcV16UcV16Uc", "")
429+
BUILTIN(__builtin_altivec_crypto_vncipherlast, "V16UcV16UcV16Uc", "")
430430
BUILTIN(__builtin_altivec_crypto_vpmsumb, "V16UcV16UcV16Uc", "")
431431
BUILTIN(__builtin_altivec_crypto_vpmsumh, "V8UsV8UsV8Us", "")
432432
BUILTIN(__builtin_altivec_crypto_vpmsumw, "V4UiV4UiV4Ui", "")

clang/lib/Headers/altivec.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17328,27 +17328,27 @@ __builtin_crypto_vsbox(vector unsigned long long __a) {
1732817328
return __builtin_altivec_crypto_vsbox(__a);
1732917329
}
1733017330

17331-
static __inline__ vector unsigned long long __attribute__((__always_inline__))
17332-
__builtin_crypto_vcipher(vector unsigned long long __a,
17333-
vector unsigned long long __b) {
17331+
static __inline__ vector unsigned char __attribute__((__always_inline__))
17332+
__builtin_crypto_vcipher(vector unsigned char __a,
17333+
vector unsigned char __b) {
1733417334
return __builtin_altivec_crypto_vcipher(__a, __b);
1733517335
}
1733617336

17337-
static __inline__ vector unsigned long long __attribute__((__always_inline__))
17338-
__builtin_crypto_vcipherlast(vector unsigned long long __a,
17339-
vector unsigned long long __b) {
17337+
static __inline__ vector unsigned char __attribute__((__always_inline__))
17338+
__builtin_crypto_vcipherlast(vector unsigned char __a,
17339+
vector unsigned char __b) {
1734017340
return __builtin_altivec_crypto_vcipherlast(__a, __b);
1734117341
}
1734217342

17343-
static __inline__ vector unsigned long long __attribute__((__always_inline__))
17344-
__builtin_crypto_vncipher(vector unsigned long long __a,
17345-
vector unsigned long long __b) {
17343+
static __inline__ vector unsigned char __attribute__((__always_inline__))
17344+
__builtin_crypto_vncipher(vector unsigned char __a,
17345+
vector unsigned char __b) {
1734617346
return __builtin_altivec_crypto_vncipher(__a, __b);
1734717347
}
1734817348

17349-
static __inline__ vector unsigned long long __attribute__((__always_inline__))
17350-
__builtin_crypto_vncipherlast(vector unsigned long long __a,
17351-
vector unsigned long long __b) {
17349+
static __inline__ vector unsigned char __attribute__((__always_inline__))
17350+
__builtin_crypto_vncipherlast(vector unsigned char __a,
17351+
vector unsigned char __b) {
1735217352
return __builtin_altivec_crypto_vncipherlast(__a, __b);
1735317353
}
1735417354
#endif /* __VSX__ */

clang/test/CodeGen/PowerPC/builtins-ppc-crypto.c

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -110,38 +110,38 @@ vector unsigned char test_vpermxoruc_be(vector unsigned char a,
110110
// CHECK: @llvm.ppc.altivec.crypto.vpermxor.be
111111
}
112112

113-
// CHECK-LABEL: define{{.*}} <2 x i64> @test_vcipher
114-
vector unsigned long long test_vcipher(void)
113+
// CHECK-LABEL: define{{.*}} <16 x i8> @test_vcipher
114+
vector unsigned char test_vcipher(void)
115115
{
116-
vector unsigned long long a = D_INIT1
117-
vector unsigned long long b = D_INIT2
116+
vector unsigned char a = B_INIT1
117+
vector unsigned char b = B_INIT2
118118
return __builtin_altivec_crypto_vcipher(a, b);
119119
// CHECK: @llvm.ppc.altivec.crypto.vcipher
120120
}
121121

122-
// CHECK-LABEL: define{{.*}} <2 x i64> @test_vcipherlast
123-
vector unsigned long long test_vcipherlast(void)
122+
// CHECK-LABEL: define{{.*}} <16 x i8> @test_vcipherlast
123+
vector unsigned char test_vcipherlast(void)
124124
{
125-
vector unsigned long long a = D_INIT1
126-
vector unsigned long long b = D_INIT2
125+
vector unsigned char a = B_INIT1
126+
vector unsigned char b = B_INIT2
127127
return __builtin_altivec_crypto_vcipherlast(a, b);
128128
// CHECK: @llvm.ppc.altivec.crypto.vcipherlast
129129
}
130130

131131
// CHECK-LABEL: @test_vncipher
132-
vector unsigned long long test_vncipher(void)
132+
vector unsigned char test_vncipher(void)
133133
{
134-
vector unsigned long long a = D_INIT1
135-
vector unsigned long long b = D_INIT2
134+
vector unsigned char a = B_INIT1
135+
vector unsigned char b = B_INIT2
136136
return __builtin_altivec_crypto_vncipher(a, b);
137137
// CHECK: @llvm.ppc.altivec.crypto.vncipher
138138
}
139139

140-
// CHECK-LABEL: define{{.*}} <2 x i64> @test_vncipherlast
141-
vector unsigned long long test_vncipherlast(void)
140+
// CHECK-LABEL: define{{.*}} <16 x i8> @test_vncipherlast
141+
vector unsigned char test_vncipherlast(void)
142142
{
143-
vector unsigned long long a = D_INIT1
144-
vector unsigned long long b = D_INIT2
143+
vector unsigned char a = B_INIT1
144+
vector unsigned char b = B_INIT2
145145
return __builtin_altivec_crypto_vncipherlast(a, b);
146146
// CHECK: @llvm.ppc.altivec.crypto.vncipherlast
147147
}
@@ -248,20 +248,20 @@ vector unsigned long long test_vpermxord_e(void)
248248
// CHECK: @llvm.ppc.altivec.crypto.vpermxor
249249
}
250250

251-
// CHECK-LABEL: define{{.*}} <2 x i64> @test_vcipher_e
252-
vector unsigned long long test_vcipher_e(void)
251+
// CHECK-LABEL: define{{.*}} <16 x i8> @test_vcipher_e
252+
vector unsigned char test_vcipher_e(void)
253253
{
254-
vector unsigned long long a = D_INIT1
255-
vector unsigned long long b = D_INIT2
254+
vector unsigned char a = B_INIT1
255+
vector unsigned char b = B_INIT2
256256
return __builtin_crypto_vcipher(a, b);
257257
// CHECK: @llvm.ppc.altivec.crypto.vcipher
258258
}
259259

260-
// CHECK-LABEL: define{{.*}} <2 x i64> @test_vcipherlast_e
261-
vector unsigned long long test_vcipherlast_e(void)
260+
// CHECK-LABEL: define{{.*}} <16 x i8> @test_vcipherlast_e
261+
vector unsigned char test_vcipherlast_e(void)
262262
{
263-
vector unsigned long long a = D_INIT1
264-
vector unsigned long long b = D_INIT2
263+
vector unsigned char a = B_INIT1
264+
vector unsigned char b = B_INIT2
265265
return __builtin_crypto_vcipherlast(a, b);
266266
// CHECK: @llvm.ppc.altivec.crypto.vcipherlast
267267
}
@@ -291,37 +291,37 @@ vector unsigned long long test_vec_sbox_be(void)
291291
}
292292

293293
// CHECK-LABEL: @test_vec_cipher_be
294-
vector unsigned long long test_vec_cipher_be(void)
294+
vector unsigned char test_vec_cipher_be(void)
295295
{
296-
vector unsigned long long a = D_INIT1
297-
vector unsigned long long b = D_INIT2
296+
vector unsigned char a = B_INIT1
297+
vector unsigned char b = B_INIT2
298298
return vec_cipher_be(a, b);
299299
// CHECK: @llvm.ppc.altivec.crypto.vcipher
300300
}
301301

302302
// CHECK-LABEL: @test_vec_cipherlast_be
303-
vector unsigned long long test_vec_cipherlast_be(void)
303+
vector unsigned char test_vec_cipherlast_be(void)
304304
{
305-
vector unsigned long long a = D_INIT1
306-
vector unsigned long long b = D_INIT2
305+
vector unsigned char a = B_INIT1
306+
vector unsigned char b = B_INIT2
307307
return vec_cipherlast_be(a, b);
308308
// CHECK: @llvm.ppc.altivec.crypto.vcipherlast
309309
}
310310

311311
// CHECK-LABEL: @test_vec_ncipher_be
312-
vector unsigned long long test_vec_ncipher_be(void)
312+
vector unsigned char test_vec_ncipher_be(void)
313313
{
314-
vector unsigned long long a = D_INIT1
315-
vector unsigned long long b = D_INIT2
314+
vector unsigned char a = B_INIT1
315+
vector unsigned char b = B_INIT2
316316
return vec_ncipher_be(a, b);
317317
// CHECK: @llvm.ppc.altivec.crypto.vncipher
318318
}
319319

320320
// CHECK-LABEL: @test_vec_ncipherlast_be
321-
vector unsigned long long test_vec_ncipherlast_be(void)
321+
vector unsigned char test_vec_ncipherlast_be(void)
322322
{
323-
vector unsigned long long a = D_INIT1
324-
vector unsigned long long b = D_INIT2
323+
vector unsigned char a = B_INIT1
324+
vector unsigned char b = B_INIT2
325325
return vec_ncipherlast_be(a, b);
326326
// CHECK: @llvm.ppc.altivec.crypto.vncipherlast
327327
}

0 commit comments

Comments
 (0)