From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WT8WB-00021G-Ug for qemu-devel@nongnu.org; Thu, 27 Mar 2014 07:30:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WT8W7-00086F-4v for qemu-devel@nongnu.org; Thu, 27 Mar 2014 07:30:43 -0400 Received: from mail-la0-f42.google.com ([209.85.215.42]:49629) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WT8W6-000868-U8 for qemu-devel@nongnu.org; Thu, 27 Mar 2014 07:30:39 -0400 Received: by mail-la0-f42.google.com with SMTP id ec20so2529191lab.29 for ; Thu, 27 Mar 2014 04:30:37 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <1395912558-1041-1-git-send-email-ard.biesheuvel@linaro.org> Date: Thu, 27 Mar 2014 12:30:37 +0100 Message-ID: From: Ard Biesheuvel Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Qemu-devel] [PATCH] target-arm: add support for v8 VMULL.P64 instruction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , Christoffer Dall , =?ISO-8859-1?Q?Andreas_F=E4rber?= On 27 March 2014 11:55, Peter Maydell wrote: > On 27 March 2014 09:29, Ard Biesheuvel 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.