target/ppc: Use clmul_64

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>
This commit is contained in:
Richard Henderson 2023-07-11 10:41:28 +01:00
parent ef73fe7cf1
commit 7bdbf233d9

View File

@ -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) void helper_VPMSUMD(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
{ {
int i, j; Int128 e = clmul_64(a->u64[0], b->u64[0]);
Int128 tmp, prod[2] = {int128_zero(), int128_zero()}; Int128 o = clmul_64(a->u64[1], b->u64[1]);
r->s128 = int128_xor(e, o);
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]);
} }
#if HOST_BIG_ENDIAN #if HOST_BIG_ENDIAN