From nobody Wed Nov 27 14:22:49 2024 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=1698279520; cv=none; d=zohomail.com; s=zohoarc; b=euMipHQc4Opxlzbv+sCDh+gElUl0MknxtkicplYGiS58+e9fqkw21Ily42LXjjL9SvhBrKvdrohiW7UXdIV7S1TopFrdIh4A4ojE3aEV9fgnZbZWHvH4YxUuDMiCqe7f+cVPnHRofGi3TaWliisvh57mhAv+tsRv13wLbFt/OSQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698279520; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=D1jMbpp1weXZkSHBUh0Jn0kijypmzVFb4f/5Y0tU+kg=; b=Cyqm3CRcN9dPg22xtTMsqH0V0vPqqqQq9GjkISRLvaqEpnDCWGOhoU8PUNf2IiTEopPBifw5hot8kz1gNGYUjPNDwpcG3sX51n8fTIhQRFFHXhnBysW7K3vfs+7lI82CTcEZJGZwU6rTII9B7Q/XhvE4ujdjDp3ZA7qBXiZCzes= 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 1698279520543447.208172851927; Wed, 25 Oct 2023 17:18:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvo2q-00075Y-Ox; Wed, 25 Oct 2023 20:16:16 -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 1qvo2i-00070N-S8 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:08 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2g-0004qO-1z for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:08 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1c9d922c039so2173545ad.3 for ; Wed, 25 Oct 2023 17:15:53 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.15.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:15:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279352; x=1698884152; darn=nongnu.org; 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=D1jMbpp1weXZkSHBUh0Jn0kijypmzVFb4f/5Y0tU+kg=; b=WmYjuOPQnWYowCgVOigqJACvsa2g/1OEDSIhZ9omh8JP1QpCmBSltEC1+Yf8gs73Sj e8raS8ecIu1+Z2Tzw2GQD5tMi6SMS3GauyVVk+5HajgOiXNo0clpo+a0pktGPggFhw7e Y8pmIjZLF0pXSmeIQ2xoqz7RK5CzSmALzP7S0zSDrEWGWHyGyHNb8SiJssTUf0j0EfUE OZsEcyD4DnhQ4NY23sIs3mskm937qPFYQWCoHvjYabh7rZG05KiOvECkGnMF1aKM8n21 tFeJUr9Xw+Ui/iFOU4wKuSJ2pJCy7IZOexgEL1U7XQXlhGcEzzhwy/DIQsDHMBCb8xtM aurw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279352; x=1698884152; 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=D1jMbpp1weXZkSHBUh0Jn0kijypmzVFb4f/5Y0tU+kg=; b=MKheI31gDT4f8GjaQ8oSjfzMvwMIjqrR4DgRkoik5B8FVEOOtM2CTo0est0H6Vq5OQ xndK/6q3YOTlUOvjbyo2WXL3vLgoIKZEi9DVh5iXAMIOKCbE3EhqqynT7gE+lDzI8ZCD 0Gx78WOpN8TCoC3lskU7KhfNuEzgJ4X5DcAU4JdFmHlFSzwcUVEua7VVhP5iwEgy1+to NmZ5/e1gaffB8bHyXquM/x77OwPQkWVyuUX+NWAirAVDleNlW8+Nn9Uv/mn+lo6NrZL+ hN6Du2cpYNSuVLA3VvrYDyjjJsKWpCFMJW1d65PVc9N1eUzIgjY74k4g0LnqnE7iOb+3 WsoQ== X-Gm-Message-State: AOJu0YySiAY3XwotLMPkfv4xBLGPUuJD8LzwbtNRWYpeklAyrW5JXbqn vo8ybcF6RgU1SU1cjM++Vkx5DfmFBr1GCusCjvM= X-Google-Smtp-Source: AGHT+IFwoTIEC/Tr7pl7KEvOj401ibO/S1DIfGRHC3W/c7vcTwruYJ4YUvPHgX+BB8fIB7hA4meI8A== X-Received: by 2002:a17:902:e747:b0:1c9:fb76:42fe with SMTP id p7-20020a170902e74700b001c9fb7642femr19636917plf.45.1698279352351; Wed, 25 Oct 2023 17:15:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 05/29] tcg/optimize: Split out arg_new_constant Date: Wed, 25 Oct 2023 17:13:49 -0700 Message-Id: <20231026001542.1141412-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-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::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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: 1698279521683100009 Content-Type: text/plain; charset="utf-8" Fixes a bug wherein raw uses of tcg_constant_internal do not have their TempOptInfo initialized. Signed-off-by: Richard Henderson --- tcg/optimize.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 76be0fc337..2f2d1c3001 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -237,6 +237,21 @@ static bool args_are_copies(TCGArg arg1, TCGArg arg2) return ts_are_copies(arg_temp(arg1), arg_temp(arg2)); } =20 +static TCGArg arg_new_constant(OptContext *ctx, uint64_t val) +{ + TCGType type =3D ctx->type; + TCGTemp *ts; + + if (type =3D=3D TCG_TYPE_I32) { + val =3D (int32_t)val; + } + + ts =3D tcg_constant_internal(type, val); + init_ts_info(ctx, ts); + + return temp_arg(ts); +} + static bool tcg_opt_gen_mov(OptContext *ctx, TCGOp *op, TCGArg dst, TCGArg= src) { TCGTemp *dst_ts =3D arg_temp(dst); @@ -293,16 +308,8 @@ static bool tcg_opt_gen_mov(OptContext *ctx, TCGOp *op= , TCGArg dst, TCGArg src) static bool tcg_opt_gen_movi(OptContext *ctx, TCGOp *op, TCGArg dst, uint64_t val) { - TCGTemp *tv; - - if (ctx->type =3D=3D TCG_TYPE_I32) { - val =3D (int32_t)val; - } - /* Convert movi to mov with constant temp. */ - tv =3D tcg_constant_internal(ctx->type, val); - init_ts_info(ctx, tv); - return tcg_opt_gen_mov(ctx, op, dst, temp_arg(tv)); + return tcg_opt_gen_mov(ctx, op, dst, arg_new_constant(ctx, val)); } =20 static uint64_t do_constant_folding_2(TCGOpcode op, uint64_t x, uint64_t y) @@ -1340,7 +1347,7 @@ static bool fold_deposit(OptContext *ctx, TCGOp *op) =20 op->opc =3D and_opc; op->args[1] =3D op->args[2]; - op->args[2] =3D temp_arg(tcg_constant_internal(ctx->type, mask)); + op->args[2] =3D arg_new_constant(ctx, mask); ctx->z_mask =3D mask & arg_info(op->args[1])->z_mask; return false; } @@ -1350,7 +1357,7 @@ static bool fold_deposit(OptContext *ctx, TCGOp *op) uint64_t mask =3D deposit64(-1, op->args[3], op->args[4], 0); =20 op->opc =3D and_opc; - op->args[2] =3D temp_arg(tcg_constant_internal(ctx->type, mask)); + op->args[2] =3D arg_new_constant(ctx, mask); ctx->z_mask =3D mask & arg_info(op->args[1])->z_mask; return false; } --=20 2.34.1