From patchwork Wed May 16 22:30:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 10405047 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F2887601F9 for ; Wed, 16 May 2018 22:58:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E593F281C3 for ; Wed, 16 May 2018 22:58:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA33528455; Wed, 16 May 2018 22:58:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 589FA28414 for ; Wed, 16 May 2018 22:58:22 +0000 (UTC) Received: from localhost ([::1]:45925 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ5NF-00056E-Kz for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 May 2018 18:58:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41543) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ4wc-00082n-FJ for qemu-devel@nongnu.org; Wed, 16 May 2018 18:30:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJ4wa-0007nw-DB for qemu-devel@nongnu.org; Wed, 16 May 2018 18:30:50 -0400 Received: from mail-pl0-x22b.google.com ([2607:f8b0:400e:c01::22b]:36191) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJ4wa-0007na-7G for qemu-devel@nongnu.org; Wed, 16 May 2018 18:30:48 -0400 Received: by mail-pl0-x22b.google.com with SMTP id v24-v6so1253312plo.3 for ; Wed, 16 May 2018 15:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dg1WBnCOa5f1mNYqPGqrKxWSClxIHHeHmUJedBN44r0=; b=CZIvaRbguCkXUfaByVoEcmgsOJzzWsWv8dGNlEZ6bu/jbtICxcr6ywcwIGkHjvYGIr PCaj2hi8sGpTotOEMqMFa6A55cGIY1wY0rqcehLirfJdPm8llfJKJWwh7X43pXYdMwLP 2iAIPTQO2QPOypKMXLg0sVw1dsyCNweLV685s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dg1WBnCOa5f1mNYqPGqrKxWSClxIHHeHmUJedBN44r0=; b=XE8IZBcaba38PciNzwW3ixR10MnGgGKPCaTVKKp2T49dRa47FyqMI0giNrfa0d5Enq OiQ3T5lmRl8tKf51Axo0c/7drPTbJtb5DpaLOqsV/NFvZabdJIq3iJQFH/MiO0nVklfF sUBQxRSkiSLl8AYJxPWgyYmGVPxpuSqkhuxFn5qUi4OPTwHqyGpanxxDTfOuht2iCcRY 8Q27qCRbwZYRPYpxE/6ykbI8xAvx1jrOww8caHNj7sQJT7VYzyl9CXSbY94aZMKGXmTF HCTZ/VU7rF8fgxG7JdXHa1y7cYzDr5nv5Tok7Gr/iwKHC3MqxS/dzloagBUP0RhCEuff qQRg== X-Gm-Message-State: ALKqPwcEOi7jhXX0gZfBH8hmkrvTL2t8Y/BNakS2U8noaq1tR0kYcjv1 4jIZ0nfCHLqQfy922fuQgJCKKNM05SI= X-Google-Smtp-Source: AB8JxZowraG2b05PUc2J+JVBx55V0oG1XMRpVNeEXzEcU2ZxkcqVdm1oH7TZ1uifUEQWXUPjWVQQNA== X-Received: by 2002:a17:902:c5:: with SMTP id a63-v6mr2702580pla.149.1526509846994; Wed, 16 May 2018 15:30:46 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-2-170.tukw.qwest.net. [97.113.2.170]) by smtp.gmail.com with ESMTPSA id j1-v6sm6640418pfc.159.2018.05.16.15.30.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 15:30:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 16 May 2018 15:30:06 -0700 Message-Id: <20180516223007.10256-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180516223007.10256-1-richard.henderson@linaro.org> References: <20180516223007.10256-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::22b Subject: [Qemu-devel] [PATCH v3-a 26/27] target/arm: Extend vec_reg_offset to larger sizes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Rearrange the arithmetic so that we are agnostic about the total size of the vector and the size of the element. This will allow us to index up to the 32nd byte and with 16-byte elements. Signed-off-by: Richard Henderson --- target/arm/translate-a64.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h index dd9c09f89b..5a97ae2b59 100644 --- a/target/arm/translate-a64.h +++ b/target/arm/translate-a64.h @@ -67,18 +67,18 @@ static inline void assert_fp_access_checked(DisasContext *s) static inline int vec_reg_offset(DisasContext *s, int regno, int element, TCGMemOp size) { - int offs = 0; + int element_size = 1 << size; + int offs = element * element_size; #ifdef HOST_WORDS_BIGENDIAN /* This is complicated slightly because vfp.zregs[n].d[0] is * still the low half and vfp.zregs[n].d[1] the high half * of the 128 bit vector, even on big endian systems. - * Calculate the offset assuming a fully bigendian 128 bits, - * then XOR to account for the order of the two 64 bit halves. + * Calculate the offset assuming a fully little-endian 128 bits, + * then XOR to account for the order of the 64 bit units. */ - offs += (16 - ((element + 1) * (1 << size))); - offs ^= 8; -#else - offs += element * (1 << size); + if (element_size < 8) { + offs ^= 8 - element_size; + } #endif offs += offsetof(CPUARMState, vfp.zregs[regno]); assert_fp_access_checked(s);