From nobody Sun Nov 2 11:43:11 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1527703615590179.98920401441876; Wed, 30 May 2018 11:06:55 -0700 (PDT) Received: from localhost ([::1]:40069 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fO5Uh-0005LP-SK for importer@patchew.org; Wed, 30 May 2018 14:06:43 -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) 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) 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-Google-Smtp-Source: ADUXVKKncgurSQlAVsKRX8Vka643P6vwBEPHD4YLDvgJlR63DLrHL8Y9YMRX2hYSyxsEIkmre5ESJQ== X-Received: by 2002:a17:902:6b09:: with SMTP id o9-v6mr3850823plk.256.1527703284384; Wed, 30 May 2018 11:01:24 -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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Peter Maydell --- target/arm/translate-a64.h | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) 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(DisasContex= t *s) static inline int vec_reg_offset(DisasContext *s, int regno, int element, TCGMemOp size) { - int offs =3D 0; + int element_size =3D 1 << size; + int offs =3D 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 +=3D (16 - ((element + 1) * (1 << size))); - offs ^=3D 8; -#else - offs +=3D element * (1 << size); + if (element_size < 8) { + offs ^=3D 8 - element_size; + } #endif offs +=3D offsetof(CPUARMState, vfp.zregs[regno]); assert_fp_access_checked(s); --=20 2.17.0