[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 04/19] target/ppc: Use clmul_8* routines
From: |
Richard Henderson |
Subject: |
[PATCH v3 04/19] target/ppc: Use clmul_8* routines |
Date: |
Mon, 21 Aug 2023 09:18:38 -0700 |
Use generic routines for 8-bit carry-less multiply.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/ppc/int_helper.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c
index 834da80fe3..343874863a 100644
--- a/target/ppc/int_helper.c
+++ b/target/ppc/int_helper.c
@@ -26,6 +26,7 @@
#include "exec/helper-proto.h"
#include "crypto/aes.h"
#include "crypto/aes-round.h"
+#include "crypto/clmul.h"
#include "fpu/softfloat.h"
#include "qapi/error.h"
#include "qemu/guest-random.h"
@@ -1425,6 +1426,18 @@ void helper_vbpermq(ppc_avr_t *r, ppc_avr_t *a,
ppc_avr_t *b)
#undef VBPERMQ_INDEX
#undef VBPERMQ_DW
+/*
+ * There is no carry across the two doublewords, so their order does
+ * not matter. Nor is there partial overlap between registers.
+ */
+void helper_vpmsumb(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
+{
+ for (int i = 0; i < 2; ++i) {
+ uint64_t aa = a->u64[i], bb = b->u64[i];
+ r->u64[i] = clmul_8x4_even(aa, bb) ^ clmul_8x4_odd(aa, bb);
+ }
+}
+
#define PMSUM(name, srcfld, trgfld, trgtyp) \
void helper_##name(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \
{ \
@@ -1445,7 +1458,6 @@ void helper_##name(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t
*b) \
} \
}
-PMSUM(vpmsumb, u8, u16, uint16_t)
PMSUM(vpmsumh, u16, u32, uint32_t)
PMSUM(vpmsumw, u32, u64, uint64_t)
--
2.34.1
- [PATCH v3 02/19] target/arm: Use clmul_8* routines, (continued)
- [PATCH v3 02/19] target/arm: Use clmul_8* routines, Richard Henderson, 2023/08/21
- [PATCH v3 06/19] target/arm: Use clmul_16* routines, Richard Henderson, 2023/08/21
- [PATCH v3 05/19] crypto: Add generic 16-bit carry-less multiply routines, Richard Henderson, 2023/08/21
- [PATCH v3 07/19] target/s390x: Use clmul_16* routines, Richard Henderson, 2023/08/21
- [PATCH v3 10/19] target/arm: Use clmul_32* routines, Richard Henderson, 2023/08/21
- [PATCH v3 14/19] target/arm: Use clmul_64, Richard Henderson, 2023/08/21
- [PATCH v3 12/19] target/ppc: Use clmul_32* routines, Richard Henderson, 2023/08/21
- [PATCH v3 17/19] target/ppc: Use clmul_64, Richard Henderson, 2023/08/21
- [PATCH v3 15/19] target/i386: Use clmul_64, Richard Henderson, 2023/08/21
- [PATCH v3 04/19] target/ppc: Use clmul_8* routines,
Richard Henderson <=
- [PATCH v3 09/19] crypto: Add generic 32-bit carry-less multiply routines, Richard Henderson, 2023/08/21
- [PATCH v3 08/19] target/ppc: Use clmul_16* routines, Richard Henderson, 2023/08/21
- [PATCH v3 13/19] crypto: Add generic 64-bit carry-less multiply routine, Richard Henderson, 2023/08/21
- [PATCH v3 11/19] target/s390x: Use clmul_32* routines, Richard Henderson, 2023/08/21
- [PATCH v3 19/19] host/include/aarch64: Implement clmul.h, Richard Henderson, 2023/08/21
- [PATCH v3 16/19] target/s390x: Use clmul_64, Richard Henderson, 2023/08/21
- [PATCH v3 18/19] host/include/i386: Implement clmul.h, Richard Henderson, 2023/08/21
- Re: [PATCH v3 00/19] crypto: Provide clmul.h and host accel, Ard Biesheuvel, 2023/08/21