From nobody Tue Apr 15 17:15:50 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1672359404; cv=none; d=zohomail.com; s=zohoarc; b=Xekz10/VcZ89Nvm3gb0iR23ONR9GK7sclOoayS4BiPkqE54KIzqoh+CsSZAiHX3tOdWydmDYS+PM0m2BO0Cy9HvwdpEOH/NzMTqpnQck8a9bKM0aR5EcTy1WjsLnZ2gOs8bBcqC+vV1zsCPY+PS707ub/s/kp0qDqwIhMhPIyCk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672359404; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2o2XDAJHkByCPpkF/Lmz5Vj1kOnPZRYyLt/A96h6Ftc=; b=EGPpROT4PJA+Ic4haQnByrnmD3wYresYxHxUcB7Mk6+kGK1CU3Unw1XyzfJtpw7FJKn7U5j5jggcru2tCPivfWQtZlIDrzp2Lg1Kgf6t0MedOLhcyvMgaKHpkItxxVd+QH6XZmgQWZHLKdFxC52LFgZrJVgyLXQzFsDDuUy9aiE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1672359404834846.4381172830683; Thu, 29 Dec 2022 16:16:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pB2sI-0003jp-82; Thu, 29 Dec 2022 19:03:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pB2rY-00039U-7d for qemu-devel@nongnu.org; Thu, 29 Dec 2022 19:03:05 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pB2rS-0002jX-6h for qemu-devel@nongnu.org; Thu, 29 Dec 2022 19:03:03 -0500 Received: by mail-pl1-x632.google.com with SMTP id s7so20361635plk.5 for ; Thu, 29 Dec 2022 16:02:48 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id j14-20020a170903028e00b00192849e1d0asm7343953plr.116.2022.12.29.16.02.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 16:02:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2o2XDAJHkByCPpkF/Lmz5Vj1kOnPZRYyLt/A96h6Ftc=; b=WOzC4oBUrSOpQ5ZnNDi1URQ60QzwVqDv/isINYLe1QLIx2UutNdUC1y+EGYkSfeUQK 9joChL8Qpv5fvsa9oVpA1TBjqI5Pkc+1l+cNXkkb6cNUqxjeOVVgXABMMo30C7q4ERyL JTjkeOcBdVOpKZhtnV91zw8HkusgFj0zqNWml42vTnlfv2yCaq4Gmz80e6hgrJtbyidH qgq+zoQdtkwChn+8iwQoChAjdGFYHQbjuj19n86S5PZfDGfRyw9SBehWz9RKwnp8dzSE isSH5FJCZEGuA3glS7Kyxiil0Itb4j9TqpbaG5bvR2Tii2yWSlCWgxxeezVCowcyZOyS yi0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2o2XDAJHkByCPpkF/Lmz5Vj1kOnPZRYyLt/A96h6Ftc=; b=1XGyga2eDwm7YBV/+/UCw3CJ1GLPrQjjNaC63yE1+v4CJ4I6DIhB8lIo092zSK0sbh cLNlSidfgQJhpQBlQ424CEsKBEBjDza1r3Z2CwCsQmGmIIPPTOJUmJys9vByDQgeXDrS iM6RI1H0KWM/vM6NbwO5ZM7LgaZ0aSuUMS0OnQx96rsXh1GjLnMspUi+P38Dr27BDWbV 6w8avgj9uYbLyLyXz2j7UIyYtpnAsqCwp/B1M5m1Ja2adX8Nv7my2wNsVbSsnUNWqQIR 7rFZATyEOsqQexntLWt0EGn5eqhWdVyO+7/x6gHA0IPH6nlexkCyY3h3VxhUhl9TqNS1 Zg7w== X-Gm-Message-State: AFqh2kpUIW6cn2G62w0chZhGBokZ3STxiIU6MLt+72fJNhyu/UglwiOo 5SuYxmuGW3G8zvJKPPIpth09idXdKlA+Aq29 X-Google-Smtp-Source: AMrXdXv5hGHx04rOx61qaE99Y5ZDmEN6qF8GU0wz3Za2r+0zct+/mPAcrUbhtQvxgtTnA/v1k21LUA== X-Received: by 2002:a17:902:eb8a:b0:192:9dc5:54b6 with SMTP id q10-20020a170902eb8a00b001929dc554b6mr5371327plg.48.1672358567831; Thu, 29 Dec 2022 16:02:47 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 27/47] tcg: Introduce tcg_type_size Date: Thu, 29 Dec 2022 16:02:01 -0800 Message-Id: <20221230000221.2764875-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221230000221.2764875-1-richard.henderson@linaro.org> References: <20221230000221.2764875-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.google.com 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1672359405767000001 Add a helper function for computing the size of a type. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 16 ++++++++++++++++ tcg/tcg.c | 27 ++++++++++++--------------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index f2da340bb9..8bcd60d0ed 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -319,6 +319,22 @@ typedef enum TCGType { #endif } TCGType; =20 +/** + * tcg_type_size + * @t: type + * + * Return the size of the type in bytes. + */ +static inline int tcg_type_size(TCGType t) +{ + unsigned i =3D t; + if (i >=3D TCG_TYPE_V64) { + tcg_debug_assert(i < TCG_TYPE_COUNT); + i -=3D TCG_TYPE_V64 - 1; + } + return 4 << i; +} + /** * get_alignment_bits * @memop: MemOp value diff --git a/tcg/tcg.c b/tcg/tcg.c index c830b3756d..02b2103daf 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3038,22 +3038,22 @@ static bool liveness_pass_2(TCGContext *s) =20 static void temp_allocate_frame(TCGContext *s, TCGTemp *ts) { - intptr_t off, size, align; + int size =3D tcg_type_size(ts->type); + int align; + intptr_t off; =20 switch (ts->type) { case TCG_TYPE_I32: - size =3D align =3D 4; + align =3D 4; break; case TCG_TYPE_I64: case TCG_TYPE_V64: - size =3D align =3D 8; + align =3D 8; break; case TCG_TYPE_V128: - size =3D align =3D 16; - break; case TCG_TYPE_V256: /* Note that we do not require aligned storage for V256. */ - size =3D 32, align =3D 16; + align =3D 16; break; default: g_assert_not_reached(); @@ -3593,8 +3593,8 @@ static void tcg_reg_alloc_dup(TCGContext *s, const TC= GOp *op) TCGRegSet dup_out_regs, dup_in_regs; TCGTemp *its, *ots; TCGType itype, vtype; - intptr_t endian_fixup; unsigned vece; + int lowpart_ofs; bool ok; =20 ots =3D arg_temp(op->args[0]); @@ -3662,15 +3662,12 @@ static void tcg_reg_alloc_dup(TCGContext *s, const = TCGOp *op) /* fall through */ =20 case TEMP_VAL_MEM: -#if HOST_BIG_ENDIAN - endian_fixup =3D itype =3D=3D TCG_TYPE_I32 ? 4 : 8; - endian_fixup -=3D 1 << vece; -#else - endian_fixup =3D 0; -#endif - /* Attempt to dup directly from the input memory slot. */ + lowpart_ofs =3D 0; + if (HOST_BIG_ENDIAN) { + lowpart_ofs =3D tcg_type_size(itype) - (1 << vece); + } if (tcg_out_dupm_vec(s, vtype, vece, ots->reg, its->mem_base->reg, - its->mem_offset + endian_fixup)) { + its->mem_offset + lowpart_ofs)) { goto done; } /* Load the input into the destination vector register. */ --=20 2.34.1