qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] target-arm: add support for v8 VMULL.P64 instru


From: Ard Biesheuvel
Subject: Re: [Qemu-devel] [PATCH] target-arm: add support for v8 VMULL.P64 instruction
Date: Thu, 27 Mar 2014 12:30:37 +0100

On 27 March 2014 11:55, Peter Maydell <address@hidden> wrote:
> On 27 March 2014 09:29, Ard Biesheuvel <address@hidden> 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 ?
>

Absolutely! I just wasn't aware there was one :-)

Regards,
Ard.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]