From patchwork Wed May 30 18:01:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 137266 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp5631757lji; Wed, 30 May 2018 11:05:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLH5CRxasZ2WaNfre1LG2rvYPEKJToiSbMOfR2DlfXk6GJqt2zZhkubXaqoMMFLKMu2AMny X-Received: by 2002:a37:7b42:: with SMTP id w63-v6mr3580987qkc.396.1527703512161; Wed, 30 May 2018 11:05:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527703512; cv=none; d=google.com; s=arc-20160816; b=J/fOwkbP2oYu1zNb21cGFu8nDZFcvapx0EvOLclXkdgLMJCP3rRB7AbKRDp6AzJZ+c jSaxgTXt0uStkLuWfinzocdhiil0gb7p2EpHofPZFXhkBceZl2Y6hDn8t4GePjY3pZ9v TAvxByfK7SG4hgq6+TX7XSGR8FuEbvYgYBEmZoI6GIOStrGRP1nqiomN7Y+HNrRAket0 CMIXB7V7N1lr1Kyb3t0TrvYTCmPGNw6+0RJBJ8SQtROqsZ9EOqes2OXz0sS+goXW3ncF jg3h2aJkmFWDY8XpdHWe0bLSNzU4GDWJloFY3rNjr/In1PoTa95FscPbdmajZMRswX2E P2yA== 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=oyxFM5ORC2u3ySgE1d8lEI9lCFBcoWljxqJhU6kL95s=; b=ura848vn48WqScCuh/ab2CrgPiT+GdrLnaZpzlVmVAOfOv0sNJBGjaI8WHWUM8EqSh FC/Y4xNImX0KJGM/AiOWk977UO30T5aDKc6leI5X60hS/Ha7E0EpRh2+ue+DWGir0bHl e8vfjPwCTQRERk5R9Z09b13pDtTPUk7PPv3la5g9t8FaYdJP2IQhejy4ZegtTl7Xl5KP CLR6gmmpBJ/vtKmuC5NNf254nMl4ma2kGhAq7wd2vT0ye2JsLoPQUAkz7dhhtBf667HR 5ySyYsZ8bpZJ7DrpaCf7IYQmYnTePFEKj35FP/HszxFTfgubrvwwrqHW6NehrInRZ92N 2xYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YU0eCKMC; 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 u14-v6si3940128qvb.224.2018.05.30.11.05.11 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 30 May 2018 11:05:12 -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=YU0eCKMC; 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]:40048 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fO5TD-0004An-JG for patch@linaro.org; Wed, 30 May 2018 14:05:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fO5Pb-0001kP-7J for qemu-devel@nongnu.org; Wed, 30 May 2018 14:01:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fO5PZ-0004LC-T5 for qemu-devel@nongnu.org; Wed, 30 May 2018 14:01:27 -0400 Received: from mail-pl0-x22c.google.com ([2607:f8b0:400e:c01::22c]:43406) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fO5PZ-0004KB-OE for qemu-devel@nongnu.org; Wed, 30 May 2018 14:01:25 -0400 Received: by mail-pl0-x22c.google.com with SMTP id c41-v6so11532918plj.10 for ; Wed, 30 May 2018 11:01:25 -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=oyxFM5ORC2u3ySgE1d8lEI9lCFBcoWljxqJhU6kL95s=; b=YU0eCKMCqeRO/43VLApx+GDVJ7sHLA90x5kPJSaMKiZtL0eVOH1fgasbgNmGeIVdwi R4VyHCDF+iQsNKQH6MQqgdnnbt5qFQ0kviuhOtqGErPsZK+lu26o0e9np7uoHUWXSNAo QO87XdBhz4vDJI04N369VzbQgmCvjF7ZYLmrU= 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=oyxFM5ORC2u3ySgE1d8lEI9lCFBcoWljxqJhU6kL95s=; b=kuqsqqENnzzre5Zk/zYobnl9vTC40mDShSuDS6e6oiBk0arBSgJHeJxwRSkMpUVSiZ Wj9EAiklS1CiGDKYicRCcK1ZFhzzeaQjJGBzlQfOjDMxLwY8YgQ5XDc5WJntEG1Td0XI nMxT65P4EsT/1RfS0CrXHjeiR6PP0CCgQBOsUzFUsjDk+B1G/Y6UWtvbD1J3ho9SoIGF FshYbCK4PuJ8uyFHMAlmNhJnkILS26UGQ1NmamlNH82MgfMxi7ATcBsDcqzV8NqGQTyr gZasj3erXO3sKfYHZqUnEzmWjuvLtTE8fQenh9MOUd7OQO5cDljFx1wnO/b7PMKXa2mF W6IQ== X-Gm-Message-State: ALKqPwdNFhcCrrz7pYYi8vJTyEPc66Vvp10GCgoYSQL6zy2bbUwZAxDE Xwjj5iSx8+chft365fUVH1+teeoQ9jI= X-Received: by 2002:a17:902:6b09:: with SMTP id o9-v6mr3850823plk.256.1527703284384; Wed, 30 May 2018 11:01:24 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-112-211.tukw.qwest.net. [97.126.112.211]) by smtp.gmail.com with ESMTPSA id b84-v6sm28179157pfm.123.2018.05.30.11.01.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 May 2018 11:01:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 30 May 2018 11:01:03 -0700 Message-Id: <20180530180120.13355-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180530180120.13355-1-richard.henderson@linaro.org> References: <20180530180120.13355-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::22c Subject: [Qemu-devel] [PATCH v3b 01/18] 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 | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) -- 2.17.0 Reviewed-by: Peter Maydell diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h index dd9c09f89b..63d958cf50 100644 --- a/target/arm/translate-a64.h +++ b/target/arm/translate-a64.h @@ -67,18 +67,26 @@ 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. + * still the lowest and vfp.zregs[n].d[15] the highest of the + * 256 byte vector, even on big endian systems. + * + * Calculate the offset assuming fully little-endian, + * then XOR to account for the order of the 8-byte units. + * + * For 16 byte elements, the two 8 byte halves will not form a + * host int128 if the host is bigendian, since they're in the + * wrong order. However the only 16 byte operation we have is + * a move, so we can ignore this for the moment. More complicated + * operations will have to special case loading and storing from + * the zregs array. */ - 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);