From nobody Tue Feb 10 20:50:07 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=1666339075; cv=none; d=zohomail.com; s=zohoarc; b=V3aST0pJPUVaJaCajRayc84Aqwj+sCyeR60yrJGiLrb8mqYhBGfU1kL2a8PiLqZrXZecmW4d8hM1jO8I8xwxwd4fpJpTfH0Z7z8nqcF2vXV3tOyiRrzZRipw4nRRHicHLY6IfEpni2zu82GEOX7yQlJMAenhzXMzl4E5YcDVTng= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666339075; h=Content-Transfer-Encoding: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=JONxt9CE65pjWaD+nTpNlKjL3nDuRwB7r5QiBKPwDCY=; b=RQ4HMQ0Hr75c6Tlvi1P4cctNIc3IbjWo3CnbhAozvo/x8TadvnjULo6LJWjJxVID+CPM26zisphpccuQ/jTW4aHrLzzdVT+pehqZf3yE/s2dR/vA69S6qtc6Cx482sMpVZfOmxkLPzsfvpb0/WVizRb/CcwEd0M/EYrq04U5QhM= 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 1666339075389471.8138134116864; Fri, 21 Oct 2022 00:57:55 -0700 (PDT) Received: from localhost ([::1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olmue-0003Fh-Ol for importer@patchew.org; Fri, 21 Oct 2022 03:57:52 -0400 Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olmHW-0003Ff-Dt for importer@patchew.org; Fri, 21 Oct 2022 03:17:26 -0400 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 1olmHG-0003CH-BJ for qemu-devel@nongnu.org; Fri, 21 Oct 2022 03:17:11 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1olmHE-0005kb-Fv for qemu-devel@nongnu.org; Fri, 21 Oct 2022 03:17:09 -0400 Received: by mail-pj1-x102b.google.com with SMTP id i3-20020a17090a3d8300b00212cf2e2af9so854516pjc.1 for ; Fri, 21 Oct 2022 00:17:08 -0700 (PDT) Received: from localhost.localdomain ([149.135.10.35]) by smtp.gmail.com with ESMTPSA id q9-20020a638c49000000b0041cd5ddde6fsm13003327pgn.76.2022.10.21.00.17.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 00:17:06 -0700 (PDT) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=JONxt9CE65pjWaD+nTpNlKjL3nDuRwB7r5QiBKPwDCY=; b=VABAGKaGx25IkbEfL0YUAnzAlz49KNPSwdhSN8lORyV5W4oMvfl237lql2virU41US jinc/H23DO4NskLnEamk54jreoJ1AYN7h2L1XZAyDQeDzJCgHnMxGuZcRBe+ue843Lo3 1zgMatg2W2t9XzCfY0UdozJ/mTPevHP4bPIF8cGWff8APMKAyAbdQjwxxlnt6oeupBd0 1QOYJC4lYbTOyapP5DqE1IIipyMc05L516aE5cLAOHuWtN/EiDZcQ8wDomlaKtCtqseh bqFSzt/t0cki/5nptwX5K1RUd7ODevRojnn01X2Ak3Xo6pmXQauznqBX10zZWjSFa9Hw R/JA== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JONxt9CE65pjWaD+nTpNlKjL3nDuRwB7r5QiBKPwDCY=; b=vpZ8+mwO7inLFPczGalCXbfNOLgybsjtDmaAtUKXEfTP1OK10CO8EBs6/1QFCMlSvj cRL13GZxvBNyAHiFZcn1F7tbiexmM/FJ284UPLue4YNHAYrdLDF/F2zaGPMP1GC3966G RXg5aaDpzbs6FTgSUzYi7Hz15/2WMDPuQ330Irz0VUOdxCe6OgkzeDljMLBZF75HzP8g 5A0ynT1yAY8aovC6TSxejuQgeylqVmZGQD0rMnQupJN9zwwt5EtZkA4ePwEzjbz353pG dvqk4oPaLYFENl9IuBJI0v3dxx+NNOlX9ZKWGk/age+uJQmLG1Sl85cW7igCdAX7SRB4 pJKg== X-Gm-Message-State: ACrzQf1CLoOB9n6W0ilmgs+V+jyzToApSBxb83lN8wktrBNGQtK40/ku MxFgVdqw8hHTJ5hdQZ+UzOiHKe6U+sFMWm6G X-Google-Smtp-Source: AMsMyM6Sh603TYee2sO0Lc1QHwbz2+IebEccL2YigTd6+YcyCiaSr553x3dulocC0u/fHuAPWamDlw== X-Received: by 2002:a17:90b:4a0b:b0:20c:5ac8:1e2c with SMTP id kk11-20020a17090b4a0b00b0020c5ac81e2cmr20417930pjb.98.1666336627030; Fri, 21 Oct 2022 00:17:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 15/36] tcg: Introduce tcg_type_size Date: Fri, 21 Oct 2022 17:15:28 +1000 Message-Id: <20221021071549.2398137-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221021071549.2398137-1-richard.henderson@linaro.org> References: <20221021071549.2398137-1-richard.henderson@linaro.org> MIME-Version: 1.0 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::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1666339077240100001 Content-Type: text/plain; charset="utf-8" Add a helper function for computing the size of a type. Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 16 ++++++++++++++++ tcg/tcg.c | 26 ++++++++++++-------------- 2 files changed, 28 insertions(+), 14 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 73d8b33b06..48b517a856 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3110,22 +3110,22 @@ static void check_regs(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(); @@ -3641,8 +3641,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]); @@ -3711,14 +3711,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 + 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; } tcg_out_ld(s, itype, ots->reg, its->mem_base->reg, its->mem_offset= ); --=20 2.34.1