[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/19] target/ppc: Use clmul_64
From: |
Richard Henderson |
Subject: |
[PULL 17/19] target/ppc: Use clmul_64 |
Date: |
Fri, 15 Sep 2023 09:42:29 -0700 |
Use generic routine for 64-bit carry-less multiply.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/ppc/int_helper.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c
index 1ea42b4ede..6fd00684a5 100644
--- a/target/ppc/int_helper.c
+++ b/target/ppc/int_helper.c
@@ -1455,20 +1455,9 @@ void helper_vpmsumw(ppc_avr_t *r, ppc_avr_t *a,
ppc_avr_t *b)
void helper_VPMSUMD(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
{
- int i, j;
- Int128 tmp, prod[2] = {int128_zero(), int128_zero()};
-
- for (j = 0; j < 64; j++) {
- for (i = 0; i < ARRAY_SIZE(r->u64); i++) {
- if (a->VsrD(i) & (1ull << j)) {
- tmp = int128_make64(b->VsrD(i));
- tmp = int128_lshift(tmp, j);
- prod[i] = int128_xor(prod[i], tmp);
- }
- }
- }
-
- r->s128 = int128_xor(prod[0], prod[1]);
+ Int128 e = clmul_64(a->u64[0], b->u64[0]);
+ Int128 o = clmul_64(a->u64[1], b->u64[1]);
+ r->s128 = int128_xor(e, o);
}
#if HOST_BIG_ENDIAN
--
2.34.1
- [PULL 05/19] crypto: Add generic 16-bit carry-less multiply routines, (continued)
- [PULL 05/19] crypto: Add generic 16-bit carry-less multiply routines, Richard Henderson, 2023/09/15
- [PULL 06/19] target/arm: Use clmul_16* routines, Richard Henderson, 2023/09/15
- [PULL 07/19] target/s390x: Use clmul_16* routines, Richard Henderson, 2023/09/15
- [PULL 08/19] target/ppc: Use clmul_16* routines, Richard Henderson, 2023/09/15
- [PULL 09/19] crypto: Add generic 32-bit carry-less multiply routines, Richard Henderson, 2023/09/15
- [PULL 10/19] target/arm: Use clmul_32* routines, Richard Henderson, 2023/09/15
- [PULL 12/19] target/ppc: Use clmul_32* routines, Richard Henderson, 2023/09/15
- [PULL 11/19] target/s390x: Use clmul_32* routines, Richard Henderson, 2023/09/15
- [PULL 15/19] target/i386: Use clmul_64, Richard Henderson, 2023/09/15
- [PULL 16/19] target/s390x: Use clmul_64, Richard Henderson, 2023/09/15
- [PULL 17/19] target/ppc: Use clmul_64,
Richard Henderson <=
- [PULL 18/19] host/include/i386: Implement clmul.h, Richard Henderson, 2023/09/15
- [PULL 13/19] crypto: Add generic 64-bit carry-less multiply routine, Richard Henderson, 2023/09/15
- [PULL 14/19] target/arm: Use clmul_64, Richard Henderson, 2023/09/15
- [PULL 19/19] host/include/aarch64: Implement clmul.h, Richard Henderson, 2023/09/15
- Re: [PULL 00/19] crypto: Provide clmul.h and host accel, Stefan Hajnoczi, 2023/09/18