[PATCH] D135834: [PowerPC] Fix parameters for __builtin_crypto_vsbox
Stefan Pintilie via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 12 17:32:09 PDT 2022
stefanp created this revision.
stefanp added reviewers: lei, nemanjai.
Herald added subscribers: shchenz, kbarton.
Herald added a project: All.
stefanp requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
The documentation specifies that the input and ouput for the builtin
__builtin_crypto_vsbox should be vector unsigned char.
This patch fixes this type for the builtin.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D135834
Files:
clang/include/clang/Basic/BuiltinsPPC.def
clang/lib/Headers/altivec.h
clang/test/CodeGen/PowerPC/builtins-ppc-crypto.c
Index: clang/test/CodeGen/PowerPC/builtins-ppc-crypto.c
===================================================================
--- clang/test/CodeGen/PowerPC/builtins-ppc-crypto.c
+++ clang/test/CodeGen/PowerPC/builtins-ppc-crypto.c
@@ -60,10 +60,10 @@
// CHECK: @llvm.ppc.altivec.crypto.vpmsumd
}
-// CHECK-LABEL: define{{.*}} <2 x i64> @test_vsbox
-vector unsigned long long test_vsbox(void)
+// CHECK-LABEL: define{{.*}} <16 x i8> @test_vsbox
+vector unsigned char test_vsbox(void)
{
- vector unsigned long long a = D_INIT1
+ vector unsigned char a = B_INIT1
return __builtin_altivec_crypto_vsbox(a);
// CHECK: @llvm.ppc.altivec.crypto.vsbox
}
@@ -200,10 +200,10 @@
// CHECK: @llvm.ppc.altivec.crypto.vpmsumd
}
-// CHECK-LABEL: define{{.*}} <2 x i64> @test_vsbox_e
-vector unsigned long long test_vsbox_e(void)
+// CHECK-LABEL: define{{.*}} <16 x i8> @test_vsbox_e
+vector unsigned char test_vsbox_e(void)
{
- vector unsigned long long a = D_INIT1
+ vector unsigned char a = B_INIT1
return __builtin_crypto_vsbox(a);
// CHECK: @llvm.ppc.altivec.crypto.vsbox
}
@@ -283,9 +283,9 @@
}
// CHECK-LABEL: @test_vec_sbox_be
-vector unsigned long long test_vec_sbox_be(void)
+vector unsigned char test_vec_sbox_be(void)
{
- vector unsigned long long a = D_INIT1
+ vector unsigned char a = B_INIT1
return vec_sbox_be(a);
// CHECK: @llvm.ppc.altivec.crypto.vsbox
}
Index: clang/lib/Headers/altivec.h
===================================================================
--- clang/lib/Headers/altivec.h
+++ clang/lib/Headers/altivec.h
@@ -17323,8 +17323,8 @@
#define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast
#ifdef __VSX__
-static __inline__ vector unsigned long long __attribute__((__always_inline__))
-__builtin_crypto_vsbox(vector unsigned long long __a) {
+static __inline__ vector unsigned char __attribute__((__always_inline__))
+__builtin_crypto_vsbox(vector unsigned char __a) {
return __builtin_altivec_crypto_vsbox(__a);
}
Index: clang/include/clang/Basic/BuiltinsPPC.def
===================================================================
--- clang/include/clang/Basic/BuiltinsPPC.def
+++ clang/include/clang/Basic/BuiltinsPPC.def
@@ -418,7 +418,7 @@
BUILTIN(__builtin_altivec_vbpermd, "V2ULLiV2ULLiV16Uc", "")
// P8 Crypto built-ins.
-BUILTIN(__builtin_altivec_crypto_vsbox, "V2ULLiV2ULLi", "")
+BUILTIN(__builtin_altivec_crypto_vsbox, "V16UcV16Uc", "")
BUILTIN(__builtin_altivec_crypto_vpermxor, "V16UcV16UcV16UcV16Uc", "")
BUILTIN(__builtin_altivec_crypto_vpermxor_be, "V16UcV16UcV16UcV16Uc", "")
BUILTIN(__builtin_altivec_crypto_vshasigmaw, "V4UiV4UiIiIi", "")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135834.467317.patch
Type: text/x-patch
Size: 2631 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221013/737323da/attachment.bin>
More information about the cfe-commits
mailing list