From nobody Tue Feb 10 19:17:14 2026 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=1670967056; cv=none; d=zohomail.com; s=zohoarc; b=Y6VqioXv1mcoQmksFlB9szBS63fJqMA8tTpGgqw9IdLuqRyD9EGRKBqPZPh1ncBPW2GEavOl6kEEFxv4U7AzECbh65RmRPDg2Qk0Ffqcy2zQaVSfUP6RtCjEYRj2sdGM1RgBNkVohlr2C4H/f2tRs96zB6FW0Jk9vi0I3z44FT8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1670967056; 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=3PNalx9xC9o37R0T2TRvL9fvT6DAngOYvV1/eVoQctk=; b=AEZPH7B3h1sEWcPUkRoDkEZt2cA3OwlagD8TQqFVbrNbjeTfzje+6PH6+CRM2GWqaYjoLB/mL88qFrZlDqhBFvRJ7lDl6Vn/gfQgYFTAAMKWoYRJngF2Qs1CyComMk9xwMpBv4IP293VKnFj43LL+F4LcperqgJKvmVrJ4yOdSw= 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 1670967056930837.8417686592107; Tue, 13 Dec 2022 13:30:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5Cml-0000e8-TG; Tue, 13 Dec 2022 16:25:59 -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 1p5Cmk-0000dO-BW for qemu-devel@nongnu.org; Tue, 13 Dec 2022 16:25:58 -0500 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p5Cmi-0003Ep-PD for qemu-devel@nongnu.org; Tue, 13 Dec 2022 16:25:58 -0500 Received: by mail-oi1-x22b.google.com with SMTP id v82so1042740oib.4 for ; Tue, 13 Dec 2022 13:25:56 -0800 (PST) Received: from stoup.. ([2806:102e:18:2efc:c63:85ed:4256:8ad0]) by smtp.gmail.com with ESMTPSA id a7-20020a056808098700b0035c073aa0d8sm5006831oic.18.2022.12.13.13.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Dec 2022 13:25:55 -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=3PNalx9xC9o37R0T2TRvL9fvT6DAngOYvV1/eVoQctk=; b=Qynv2f2/vRtNDVUKBo6HgeFZD8XuMJA+SSC0Cq6RS9h3xa9sFQmJPSBdMTWMQOIE9n bEDGMdWnyV01yeI0dhnum3xF0fgTF4KrHpGVwHY9cSVU3r3PJMtn5AQTrDLJrx5LVH5i dFR0GmEKX6XPK/aajWcoRYMDrEkhuhGPvsHkSbPhpFANurqJsq6U3jB4mu7m1QHVs7Os T4c8fQazaL+w5bh7Lej5m56hU0JmaOiogzOuL2KjbHmjliV9N/by/SuC0P0z7l/uDyme fav+h5j8MyYFSi1r1L9M5HUsc4lFiu4OAIMJcTqeCzf9q/CNo58k0M+2RcRKAbg2fTG2 q6+w== 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=3PNalx9xC9o37R0T2TRvL9fvT6DAngOYvV1/eVoQctk=; b=YJI/sN4WWZWTm0DerhhQ9xCc434m0CiRRIQ4efdgfZkWAp2/d/IzFnsIyH3InBqFG0 vB9uZowDWQBaNnVfxzNDfcb4AxTmN+VXqsSVWpplaH5ZBnLfe8OIMgjKu56Dx8Odb1T5 AuFaEr7fFVkcKb8SYcQC0gPqJTyOeKJt+abI7Xn3vq/d3g8/nBkzBN3TY4JJ+INjEsCf fV6zJmz19p21eFRLIzUTOoLBgCST36c78LztbeqBPQdqVQDSO0+wxT8mr6eGjiwYdw2Z 2AEDdDB0fiQUSDnEDL80QmzPYcrCzkjRz7OPDoVNap5JmZj4ID+5xNVTTzIndJAWIlwV /s1g== X-Gm-Message-State: ANoB5pl6QoOcXqV5IhjIa0cJyjMFrT/V5f0t3T9IjohdcPUQwC7qSygu FmKFo8whe1wtqHJH04EmScqb8nz9G3eXhK8XsY0= X-Google-Smtp-Source: AA0mqf7BCEqaa9nWwr7dwlzf84FA6nTD/bOag2tFWKIYEXZE1hZfBPRZh8KFwtD1m6XRNCHgc59ZpQ== X-Received: by 2002:a05:6808:1a9c:b0:35a:2589:1c2d with SMTP id bm28-20020a0568081a9c00b0035a25891c2dmr8982882oib.44.1670966755674; Tue, 13 Dec 2022 13:25:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 12/27] tcg: Introduce tcg_type_size Date: Tue, 13 Dec 2022 15:25:26 -0600 Message-Id: <20221213212541.1820840-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221213212541.1820840-1-richard.henderson@linaro.org> References: <20221213212541.1820840-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::22b; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22b.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: 1670967058087100001 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 dbf4e864eb..12676268a2 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