From patchwork Wed Jun 13 01:56:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138385 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp98111lji; Tue, 12 Jun 2018 18:59:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKFeYFUzzAl5K69GaIyNxnX0Not1AIothHqw2XUI2LaFyhBwDvapHqAjxeElVnPd3iiNIbO X-Received: by 2002:a37:59c3:: with SMTP id n186-v6mr2790291qkb.132.1528855197925; Tue, 12 Jun 2018 18:59:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528855197; cv=none; d=google.com; s=arc-20160816; b=BigiBiXrZXpUFJoRybHholW4S6nPfL8PaoUcu/G4yGrQ7hjvG1kwzbj+GyBuN4znUL xU/URnfKyON9e0nNxXBkZg+BKMPRy6ftTguh5L9ICOOOhX5kIGLoG4p+kifC8tjY9nV1 ygqNYVuiQKLolr99uNq5EW1KxpvB3rPV3hWXGCFli5xiIW4NHTq2utFRhe8qo/Ids8d0 5Zi+juMyCrUiy2VvUzC8QY6ee/4Gg1B6aDeIk0iORu5yIxlQ0Tsn/f1BfPGqdrxg785M lwP0bq96L09GjUqvaNWqowmZL34CyHI3QIlp4Rp96NT3dMNokMBHLf/TZlXaN9AD7em2 3wvw== 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=HFOHgvtQT4ZuVKP1qbPlOREDEdltSEASyGZntkspWL4=; b=MrKCwMyHTFMUHNajIDcb6Dnw8tEM8kqij5zJVnxyhMNxqElbCQbfbH20nC4U+uSRcx smCAFL4NQBCF3gkhiP/b8gwNTNc94ZL453LpcJJfqyxtI5ULACYMT3Iw8iwU4uxJkYO6 pKSqs7XybOegWHyLHlpcf+Hgp75WOW7KrD6P3aBCJs/R4lACVYsvEARxVM/O9Sv++Q2v sud93TkONbN8mR0LCLao80dk418sDKEd5lWbNRnv6QURLoI91UTvk/f1i7h1hm1F1ewB zPwK1vvtpqVhQk+1Veo63gy8q4dBOJch7YMJTPJVP9rkIEWgKIeR4SJ4RLy9WvK8VOq2 bYEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IuoqqLdJ; 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 k189-v6si1586493qkf.39.2018.06.12.18.59.57 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 12 Jun 2018 18:59: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=IuoqqLdJ; 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]:59273 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSv4n-0004du-AA for patch@linaro.org; Tue, 12 Jun 2018 21:59:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSv1s-0002A7-OZ for qemu-devel@nongnu.org; Tue, 12 Jun 2018 21:56:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSv1q-0006Cb-Lg for qemu-devel@nongnu.org; Tue, 12 Jun 2018 21:56:56 -0400 Received: from mail-pg0-x229.google.com ([2607:f8b0:400e:c05::229]:41549) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fSv1q-0006CR-FD for qemu-devel@nongnu.org; Tue, 12 Jun 2018 21:56:54 -0400 Received: by mail-pg0-x229.google.com with SMTP id l65-v6so455733pgl.8 for ; Tue, 12 Jun 2018 18:56:54 -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=HFOHgvtQT4ZuVKP1qbPlOREDEdltSEASyGZntkspWL4=; b=IuoqqLdJxj7k/iXG/4gXqh93bm7y+SyLUxmfVacXGmi1NfPVVsKZz4LWdIdUf3Dl+y dngKaAPPRThWgJPU97ftXbOCLC/5YpSoBaGYyEfq0A5TTlqG//kcFAZbXx/zEJTcP1Oy g2doR8MgosMFE/58eTyHHK7OXC5I+31ogaZyc= 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=HFOHgvtQT4ZuVKP1qbPlOREDEdltSEASyGZntkspWL4=; b=lD3SlziLp/obpyhxpxbb64JDm9QYtYH8fIdv8tjKjZEwJwc1ekJzSpgl2HCJl7Ms3g tsEUujSJeaxLmiG+/AO8umh6sWk4lPGD0EKJjJ6vcsCdX+WMQMGU6ttbt2xTa3jRYYpW KJxZ0CLSbv6F8PAcKOXMEswln32GmTzTBR8g5mB99UX8xD4Bmr9n9AoIeCLgK/bNuz9A 7GtBCPFv5XT6qqlpKdaTRsQ0K+9BY4WwNq3r50VTDUTzs/LgaTnJjLBOpqpcaHgn8DdT 3vB9WsWzftzUdCfuKo3fYBVc5VuszUI/LAaquhRrtjMdCEAOcYclnk+IfAUXsvS/FTzU 7knw== X-Gm-Message-State: APt69E3+XXp8vSA7zqmjKRA61XfwQj2Xb/UVuyxLHNEm5nSJYgjhLNTN yNjIK6t9oVYYsmb7SRyQzaed2pKQe8Q= X-Received: by 2002:a65:6007:: with SMTP id m7-v6mr2320808pgu.92.1528855013159; Tue, 12 Jun 2018 18:56:53 -0700 (PDT) Received: from cloudburst.twiddle.net (rrcs-173-198-77-219.west.biz.rr.com. [173.198.77.219]) by smtp.gmail.com with ESMTPSA id g10-v6sm1647287pfi.148.2018.06.12.18.56.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 18:56:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 12 Jun 2018 15:56:24 -1000 Message-Id: <20180613015641.5667-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180613015641.5667-1-richard.henderson@linaro.org> References: <20180613015641.5667-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:c05::229 Subject: [Qemu-devel] [PATCH v4b 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 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. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate-a64.h | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) -- 2.17.1 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);