From patchwork Fri Oct 30 02:26:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 319985 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp1015056ilc; Thu, 29 Oct 2020 19:30:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJPyBWSEDrTXOv+rhSIyqSLXj9buydZtCEmiGZKvpL7UvQiygqVz+5HqP6VpeJMRdTRVVU X-Received: by 2002:a25:be90:: with SMTP id i16mr497419ybk.189.1604025042506; Thu, 29 Oct 2020 19:30:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604025042; cv=none; d=google.com; s=arc-20160816; b=VBpDpc6fHrrE4bex6OmUPA0NSVuUG0MpVTeC2ZTxFUkd7+e3WyigVYTcWb0pbHAP4Z Y/K761Vnc1UdNMwhFhmL+KriM5aRKiobM/xetGXqzr6u9Osg2g5L/QdrNL3e/1FHQS2b 7mv5gR5e0PyWJ2a1h3NrwpK5P7TBy7qdOIqMV+HXqxMShbf4hVXTZIVn5bfuaOBxVrfm Z1U6W///pyAs3/oOtBh/bX9iB4sgNf73yTl02bH1fTreJalvA3mwqJ1zFs/6aule6ebq GvvJDbaGe3gNPLxvH+UzrIA0v0AR+V/LQ5+d0cjcsglgCyYFiVSdVsjlc09KQ6lNpV5Q 4iTg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=h4nXGEfFKdYYxAxVCeZfgKCWCHDlbl0aB+zYefgN5rQ=; b=P6wf3GXa252kABVzXn9mi+/fngAi2ZVljhsB4LvYSv8ptEcvvG6HMxO+GYPfO3V3yI s34XvIn3pMx/i1GKMFqVnZU9p6u2mhYOhODvgqGp2iwxzCrXr5VsPICk5eQHdQD7NbUr 2E2c7wrLOgCrvwKflQUpbHfjVE98UY/BmbZhIHn3xzHgw2IdlTzs4dm8gK3cKkMmGbqT H/b5koBH9HoK/mTsyOCJFykrJ+wU98/WMiBrnrnqDCz4q+bloaIJP4MLA87/poLjVhKV Z4/zvrd6I5a3tFVfY2nQXVlgZqY8cHAbHpV/NtU4DOqc6OL4k/PctCaUXzAFdKIm706R 58nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=beTkeJwF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e4si5044201ybp.361.2020.10.29.19.30.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Oct 2020 19:30:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=beTkeJwF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYKBd-0001t7-V6 for patch@linaro.org; Thu, 29 Oct 2020 22:30:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYK7Y-000513-H5 for qemu-devel@nongnu.org; Thu, 29 Oct 2020 22:26:28 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:39071) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kYK7X-0005un-2B for qemu-devel@nongnu.org; Thu, 29 Oct 2020 22:26:28 -0400 Received: by mail-pf1-x444.google.com with SMTP id e15so3979424pfh.6 for ; Thu, 29 Oct 2020 19:26:26 -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 :mime-version:content-transfer-encoding; bh=h4nXGEfFKdYYxAxVCeZfgKCWCHDlbl0aB+zYefgN5rQ=; b=beTkeJwF0RNwyM5S8cby2EtTfgia+VK55dpYJO451RHn6Suyf1C/HNkT9a+FT1dDyQ CbSYtq529xfbp08/Nbw5kKYqfjWICC5UOpRhLdT7IIPt71CbDwsHaG8QIjioW8wxhemS TmYEvg29N3/NPZ83iZcOodJUubgQxQGqzF7JYIL0TQmBJRvaLTCxJ9fRw1ITp+Kjr+DW 5W64PD7kDbe/kTEroV5e/7qC9p1Qz2IqYdyYylxlVSGy49VgG++YrGIanbR15btrkaHG jvQ24pA8btIMd31qxV3NUKlZZaMgHJGQVjLOsvWbWTJxQSGlHw8PwQSizgmoldfFLzEc a/dA== 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:mime-version:content-transfer-encoding; bh=h4nXGEfFKdYYxAxVCeZfgKCWCHDlbl0aB+zYefgN5rQ=; b=mSp6wMGfHDFnceNqns6HuAl+hqXYB/lO5SlGqNgd/8EF2QO9jcqEjgjoh4YToJjgCl 15+y7y380QZs80u3irWJIkKbv85xzqaXklHVJAo7PbfG5n8wzoQofWjJb2eoy/vEBP38 Yhgo2HeP8r3wXLFL57NFMdtZ+j1+CSRQ4JFQj6/Uye4ViG9OfRmVpHpMEGOmUFMJLcSE wHWQymT0ImSGdY8xxpXMALCWG76BulxbkbiH8QxkesViw4XCS2BDBqzJjUwmHqFdMlFT /GEaVBNkF0p9LNOb52pCQMGjhMc8+a5K7mSc7JIe4hoES3N41rV1GY9KOqV+AC5erSI7 d64Q== X-Gm-Message-State: AOAM533c5X4PR/K2kXRcS3CvxaQjSLyE8SdW1HQdXtfkLkGTnukpWSgc I78clPhswLlNRHMG/6mHdqE193kHroSBYQ== X-Received: by 2002:a17:90a:fa93:: with SMTP id cu19mr89530pjb.117.1604024785397; Thu, 29 Oct 2020 19:26:25 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id b7sm4446517pfr.171.2020.10.29.19.26.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 19:26:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 04/11] target/arm: Use neon_element_offset in vfp_reg_offset Date: Thu, 29 Oct 2020 19:26:11 -0700 Message-Id: <20201030022618.785675-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201030022618.785675-1-richard.henderson@linaro.org> References: <20201030022618.785675-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::444; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x444.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" This seems a bit more readable than using offsetof CPU_DoubleU. Signed-off-by: Richard Henderson --- target/arm/translate.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) -- 2.25.1 diff --git a/target/arm/translate.c b/target/arm/translate.c index 88a926d1df..88ded4ac2c 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1122,18 +1122,13 @@ static long neon_element_offset(int reg, int element, MemOp size) return neon_full_reg_offset(reg) + ofs; } -static inline long vfp_reg_offset(bool dp, unsigned reg) +/* Return the offset of a VFP Dreg (dp = true) or VFP Sreg (dp = false). */ +static long vfp_reg_offset(bool dp, unsigned reg) { if (dp) { - return offsetof(CPUARMState, vfp.zregs[reg >> 1].d[reg & 1]); + return neon_element_offset(reg, 0, MO_64); } else { - long ofs = offsetof(CPUARMState, vfp.zregs[reg >> 2].d[(reg >> 1) & 1]); - if (reg & 1) { - ofs += offsetof(CPU_DoubleU, l.upper); - } else { - ofs += offsetof(CPU_DoubleU, l.lower); - } - return ofs; + return neon_element_offset(reg >> 1, reg & 1, MO_32); } }