On 27 March 2014 09:29, Ard Biesheuvel <ard.biesheu...@linaro.org> wrote:
> This adds support for the VMULL.P64 polynomial 64x64 to 128 bit multiplication
> instruction, which is an optional feature that is part of the v8 Crypto
> Extensions.

> +void HELPER(crypto_pmull)(CPUARMState *env, uint32_t rd, uint32_t rn,
> +                          uint32_t rm)
> +{
> +    uint64_t n = float64_val(env->vfp.regs[rn]);
> +    uint64_t m = float64_val(env->vfp.regs[rm]);
> +    uint64_t d0 = (n & 1) ? m : 0;
> +    uint64_t d1 = 0;
> +    int shift;
> +
> +    for (shift = 1; (n >>= 1); shift++) {
> +        if (n & 1) {
> +            d0 ^= m << shift;
> +            d1 ^= m >> (64 - shift);
> +        }
> +    }
> +    env->vfp.regs[rd] = make_float64(d0);
> +    env->vfp.regs[rd + 1] = make_float64(d1);
> +}

Surely we can reuse the helper we already have for implementing
the A64 version of this instruction ?

thanks
-- PMM

Reply via email to