[clang] 0e2e1fc - [PowerPC] Fix types for vcipher builtins.
Stefan Pintilie via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 6 12:21:42 PDT 2022
Author: Stefan Pintilie
Date: 2022-10-06T14:21:34-05:00
New Revision: 0e2e1fc90a01f84b982b48fb9189c06aec55baed
URL: https://github.com/llvm/llvm-project/commit/0e2e1fc90a01f84b982b48fb9189c06aec55baed
DIFF: https://github.com/llvm/llvm-project/commit/0e2e1fc90a01f84b982b48fb9189c06aec55baed.diff
LOG: [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
Added:
Modified:
clang/include/clang/Basic/BuiltinsPPC.def
clang/lib/Headers/altivec.h
clang/test/CodeGen/PowerPC/builtins-ppc-crypto.c
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/BuiltinsPPC.def b/clang/include/clang/Basic/BuiltinsPPC.def
index a7a242b4f659d..df36c605f6535 100644
--- a/clang/include/clang/Basic/BuiltinsPPC.def
+++ b/clang/include/clang/Basic/BuiltinsPPC.def
@@ -423,10 +423,10 @@ BUILTIN(__builtin_altivec_crypto_vpermxor, "V16UcV16UcV16UcV16Uc", "")
BUILTIN(__builtin_altivec_crypto_vpermxor_be, "V16UcV16UcV16UcV16Uc", "")
BUILTIN(__builtin_altivec_crypto_vshasigmaw, "V4UiV4UiIiIi", "")
BUILTIN(__builtin_altivec_crypto_vshasigmad, "V2ULLiV2ULLiIiIi", "")
-BUILTIN(__builtin_altivec_crypto_vcipher, "V2ULLiV2ULLiV2ULLi", "")
-BUILTIN(__builtin_altivec_crypto_vcipherlast, "V2ULLiV2ULLiV2ULLi", "")
-BUILTIN(__builtin_altivec_crypto_vncipher, "V2ULLiV2ULLiV2ULLi", "")
-BUILTIN(__builtin_altivec_crypto_vncipherlast, "V2ULLiV2ULLiV2ULLi", "")
+BUILTIN(__builtin_altivec_crypto_vcipher, "V16UcV16UcV16Uc", "")
+BUILTIN(__builtin_altivec_crypto_vcipherlast, "V16UcV16UcV16Uc", "")
+BUILTIN(__builtin_altivec_crypto_vncipher, "V16UcV16UcV16Uc", "")
+BUILTIN(__builtin_altivec_crypto_vncipherlast, "V16UcV16UcV16Uc", "")
BUILTIN(__builtin_altivec_crypto_vpmsumb, "V16UcV16UcV16Uc", "")
BUILTIN(__builtin_altivec_crypto_vpmsumh, "V8UsV8UsV8Us", "")
BUILTIN(__builtin_altivec_crypto_vpmsumw, "V4UiV4UiV4Ui", "")
diff --git a/clang/lib/Headers/altivec.h b/clang/lib/Headers/altivec.h
index 0b1e76e81cc77..b4dbe0dd8b22d 100644
--- a/clang/lib/Headers/altivec.h
+++ b/clang/lib/Headers/altivec.h
@@ -17328,27 +17328,27 @@ __builtin_crypto_vsbox(vector unsigned long long __a) {
return __builtin_altivec_crypto_vsbox(__a);
}
-static __inline__ vector unsigned long long __attribute__((__always_inline__))
-__builtin_crypto_vcipher(vector unsigned long long __a,
- vector unsigned long long __b) {
+static __inline__ vector unsigned char __attribute__((__always_inline__))
+__builtin_crypto_vcipher(vector unsigned char __a,
+ vector unsigned char __b) {
return __builtin_altivec_crypto_vcipher(__a, __b);
}
-static __inline__ vector unsigned long long __attribute__((__always_inline__))
-__builtin_crypto_vcipherlast(vector unsigned long long __a,
- vector unsigned long long __b) {
+static __inline__ vector unsigned char __attribute__((__always_inline__))
+__builtin_crypto_vcipherlast(vector unsigned char __a,
+ vector unsigned char __b) {
return __builtin_altivec_crypto_vcipherlast(__a, __b);
}
-static __inline__ vector unsigned long long __attribute__((__always_inline__))
-__builtin_crypto_vncipher(vector unsigned long long __a,
- vector unsigned long long __b) {
+static __inline__ vector unsigned char __attribute__((__always_inline__))
+__builtin_crypto_vncipher(vector unsigned char __a,
+ vector unsigned char __b) {
return __builtin_altivec_crypto_vncipher(__a, __b);
}
-static __inline__ vector unsigned long long __attribute__((__always_inline__))
-__builtin_crypto_vncipherlast(vector unsigned long long __a,
- vector unsigned long long __b) {
+static __inline__ vector unsigned char __attribute__((__always_inline__))
+__builtin_crypto_vncipherlast(vector unsigned char __a,
+ vector unsigned char __b) {
return __builtin_altivec_crypto_vncipherlast(__a, __b);
}
#endif /* __VSX__ */
diff --git a/clang/test/CodeGen/PowerPC/builtins-ppc-crypto.c b/clang/test/CodeGen/PowerPC/builtins-ppc-crypto.c
index 9e0428414455f..0c4d54c09e012 100644
--- a/clang/test/CodeGen/PowerPC/builtins-ppc-crypto.c
+++ b/clang/test/CodeGen/PowerPC/builtins-ppc-crypto.c
@@ -110,38 +110,38 @@ vector unsigned char test_vpermxoruc_be(vector unsigned char a,
// CHECK: @llvm.ppc.altivec.crypto.vpermxor.be
}
-// CHECK-LABEL: define{{.*}} <2 x i64> @test_vcipher
-vector unsigned long long test_vcipher(void)
+// CHECK-LABEL: define{{.*}} <16 x i8> @test_vcipher
+vector unsigned char test_vcipher(void)
{
- vector unsigned long long a = D_INIT1
- vector unsigned long long b = D_INIT2
+ vector unsigned char a = B_INIT1
+ vector unsigned char b = B_INIT2
return __builtin_altivec_crypto_vcipher(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vcipher
}
-// CHECK-LABEL: define{{.*}} <2 x i64> @test_vcipherlast
-vector unsigned long long test_vcipherlast(void)
+// CHECK-LABEL: define{{.*}} <16 x i8> @test_vcipherlast
+vector unsigned char test_vcipherlast(void)
{
- vector unsigned long long a = D_INIT1
- vector unsigned long long b = D_INIT2
+ vector unsigned char a = B_INIT1
+ vector unsigned char b = B_INIT2
return __builtin_altivec_crypto_vcipherlast(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vcipherlast
}
// CHECK-LABEL: @test_vncipher
-vector unsigned long long test_vncipher(void)
+vector unsigned char test_vncipher(void)
{
- vector unsigned long long a = D_INIT1
- vector unsigned long long b = D_INIT2
+ vector unsigned char a = B_INIT1
+ vector unsigned char b = B_INIT2
return __builtin_altivec_crypto_vncipher(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vncipher
}
-// CHECK-LABEL: define{{.*}} <2 x i64> @test_vncipherlast
-vector unsigned long long test_vncipherlast(void)
+// CHECK-LABEL: define{{.*}} <16 x i8> @test_vncipherlast
+vector unsigned char test_vncipherlast(void)
{
- vector unsigned long long a = D_INIT1
- vector unsigned long long b = D_INIT2
+ vector unsigned char a = B_INIT1
+ vector unsigned char b = B_INIT2
return __builtin_altivec_crypto_vncipherlast(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vncipherlast
}
@@ -248,20 +248,20 @@ vector unsigned long long test_vpermxord_e(void)
// CHECK: @llvm.ppc.altivec.crypto.vpermxor
}
-// CHECK-LABEL: define{{.*}} <2 x i64> @test_vcipher_e
-vector unsigned long long test_vcipher_e(void)
+// CHECK-LABEL: define{{.*}} <16 x i8> @test_vcipher_e
+vector unsigned char test_vcipher_e(void)
{
- vector unsigned long long a = D_INIT1
- vector unsigned long long b = D_INIT2
+ vector unsigned char a = B_INIT1
+ vector unsigned char b = B_INIT2
return __builtin_crypto_vcipher(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vcipher
}
-// CHECK-LABEL: define{{.*}} <2 x i64> @test_vcipherlast_e
-vector unsigned long long test_vcipherlast_e(void)
+// CHECK-LABEL: define{{.*}} <16 x i8> @test_vcipherlast_e
+vector unsigned char test_vcipherlast_e(void)
{
- vector unsigned long long a = D_INIT1
- vector unsigned long long b = D_INIT2
+ vector unsigned char a = B_INIT1
+ vector unsigned char b = B_INIT2
return __builtin_crypto_vcipherlast(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vcipherlast
}
@@ -291,37 +291,37 @@ vector unsigned long long test_vec_sbox_be(void)
}
// CHECK-LABEL: @test_vec_cipher_be
-vector unsigned long long test_vec_cipher_be(void)
+vector unsigned char test_vec_cipher_be(void)
{
- vector unsigned long long a = D_INIT1
- vector unsigned long long b = D_INIT2
+ vector unsigned char a = B_INIT1
+ vector unsigned char b = B_INIT2
return vec_cipher_be(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vcipher
}
// CHECK-LABEL: @test_vec_cipherlast_be
-vector unsigned long long test_vec_cipherlast_be(void)
+vector unsigned char test_vec_cipherlast_be(void)
{
- vector unsigned long long a = D_INIT1
- vector unsigned long long b = D_INIT2
+ vector unsigned char a = B_INIT1
+ vector unsigned char b = B_INIT2
return vec_cipherlast_be(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vcipherlast
}
// CHECK-LABEL: @test_vec_ncipher_be
-vector unsigned long long test_vec_ncipher_be(void)
+vector unsigned char test_vec_ncipher_be(void)
{
- vector unsigned long long a = D_INIT1
- vector unsigned long long b = D_INIT2
+ vector unsigned char a = B_INIT1
+ vector unsigned char b = B_INIT2
return vec_ncipher_be(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vncipher
}
// CHECK-LABEL: @test_vec_ncipherlast_be
-vector unsigned long long test_vec_ncipherlast_be(void)
+vector unsigned char test_vec_ncipherlast_be(void)
{
- vector unsigned long long a = D_INIT1
- vector unsigned long long b = D_INIT2
+ vector unsigned char a = B_INIT1
+ vector unsigned char b = B_INIT2
return vec_ncipherlast_be(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vncipherlast
}
More information about the cfe-commits
mailing list