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: 136076 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1545885lji; Wed, 16 May 2018 15:57:57 -0700 (PDT) X-Google-Smtp-Source: AB8JxZonudMhc2k70EfmgsRluAjIyQ9O6+LMTj9wuqv5IpkK+h27v0iXbGAmhv7njbR4ACP5A0TH X-Received: by 2002:a37:9285:: with SMTP id u127-v6mr2868024qkd.261.1526511477679; Wed, 16 May 2018 15:57:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526511477; cv=none; d=google.com; s=arc-20160816; b=gn1gNV2f0FSQGWXci8bBbfUKRkFDCFyAYEs9TXNLh56yLBBnCbdsJZJ/yh5tdn5vKJ Kl/gWWHbAw0ejlgHwvavWtxZK7VjfPsRjF9o2eNqU/zEh5xT2fGODQkgs8XyojtUZIW/ V2nBM7B5eubIYKzayl3aIMrjD+wsDZk/ODyDemTFWNsni+E5zieBqR2zkeLr29nj9Kbn vnA67Xtjsel8cKbCAKjnGKgduiqGu2AyjgDNxZr6i/kjPgE8gGaWgCJaQHVi31NHY+Gx J0LHfXPP5CQSA8uu1IV2bs549S1kzTCQnESeXo6ZS3cxxjEHD3TRej1nQ5T8nMNHJntP StsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=dg1WBnCOa5f1mNYqPGqrKxWSClxIHHeHmUJedBN44r0=; b=CbKzjbKa0/Mt1aRMm5/hecm/Kk8UJnBruaqFqaR+en0gSJyaOW5IUOKiYlvx8xXB+q mVwjePt2MiRBfMSG9S7guWUKIlBB9fd8jnyFnTwf3wZm6UMmphXnfBzA0cU05Zf2e6zo EH6Rp4dAlNWrMhQjf5J/wMIxZvkY5j9SxQNbda+tTDqHYZJmSuTsvEsiYQzYazRpO7yU mN5GWMEOLG29KO330+FyplSD6QlmhL4eeqmq7pXP2JB1FpOWFWCoLWf2a2drkcoTN9r7 YwXSzy5wDaRuGY/ExJOH4NMQizhUu5RA13zxLNF2DPZaVxAZMpD0oaioAZc0pfYByibY lFuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=CZIvaRbg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o25-v6si3703745qve.58.2018.05.16.15.57.57 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 16 May 2018 15:57:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=CZIvaRbg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45901 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ5Mr-0004jn-8A for patch@linaro.org; Wed, 16 May 2018 18:57:57 -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-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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.17.0 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);