From nobody Wed Nov 27 14:36:00 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=1698522435; cv=none; d=zohomail.com; s=zohoarc; b=I4sMAyLSKWmYMuoKdAvFxewEuAe/8dKsdpzFsRl3cu2mLDn8ckg8SNV7MLwmfFGRaO1bGb4qusijXONFLhpc3aWR/sKt7yhkqzgD85Qbkw+6s2JTh7Lpjmrq0vhUHidW7zpt5M5qclSZYdn8C4yAuYkshqPF6AJtzRyrjm+DVl0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698522435; h=Content-Transfer-Encoding:Cc:Cc: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; bh=D1jMbpp1weXZkSHBUh0Jn0kijypmzVFb4f/5Y0tU+kg=; b=jmYtdjmD3Y/+G4cIAuCkDbWsfYqoXsgkO1o+Om2FewUQXZNvY/8U6NY9CD0/EKo8b3aLqVMzcX3YYOsZgtBxjEYQGvvD+fA1j5KGFoobLf+q2f6jgzfaUtlsNSYhlSf25xTryeyuSHtcSCC2MBpL7d47DHCOizTSuB0rEtwipp4= 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 1698522435404897.9826784431829; Sat, 28 Oct 2023 12:47:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwpFW-0004iG-Aq; Sat, 28 Oct 2023 15:45:34 -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 1qwpFV-0004hp-52 for qemu-devel@nongnu.org; Sat, 28 Oct 2023 15:45:33 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qwpFS-00046J-FW for qemu-devel@nongnu.org; Sat, 28 Oct 2023 15:45:32 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1c77449a6daso27557555ad.0 for ; Sat, 28 Oct 2023 12:45:30 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h9-20020a170902f7c900b001b8a3e2c241sm3600096plw.14.2023.10.28.12.45.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Oct 2023 12:45:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698522329; x=1699127129; darn=nongnu.org; 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=D1jMbpp1weXZkSHBUh0Jn0kijypmzVFb4f/5Y0tU+kg=; b=B+qqh9KzbJAmk7ijJi0JUQ0IY60X79ZG6rtnWdP6+1BXP8I4N4M+6SuympYvucNc96 NoR+VnZS2ISjSmhQ9D6NMaQ2ey1gZTRH6kMibpaj9/s8rLFzjOcY5zVZrT1Wjd0ZSD4C hKrjRSkwCEjVrq4TgMWPxB6NNmeM7wNh1lwfHHoUndBGH1FU6QFB8nZWvFteQifCxpdh qx0ixuAHHi1M0vHp4bhdbe3Rd6lTagwDVdvbkgNRIqaTsyo6251ND8uDCXksrE/4coiO LUOqL9g3jBgyC9n11/rIreWow0emxLI4T6uO4J4i2tcTnm7Xl+z7NdKzUVJb+GVzXNex DJlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698522329; x=1699127129; 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=D1jMbpp1weXZkSHBUh0Jn0kijypmzVFb4f/5Y0tU+kg=; b=pX/sRnD62rO9RISneRazu6vWnojWzCnJNem9+t2oryn6dqIm/aVDNOEMk8vb1cpbsN ySBAk/VGxuYvFlVsmdh74UOz9650Ht1n16yWD3CtF3R0jQKliB38VK9TKbVbB0p4kTTS RFtSgk50hFbWRHTCjRIII859qBGqFrekKFy27yzBXQUPGbEFzHLJdSCYMId7ZgDjg8k0 l9DyjXQvsIuRK7AgWG0fxTQZI59BCBjYHEsGq244X+Yhx58913KvVY6Er8Mk8ljE4GC4 qsXzwXQNOgbyNZUTEPty3IcTF4gMuzAcFSzhvawHWMzZH5GuQ/rEuqiljgUwVbTqSvCQ 4xLg== X-Gm-Message-State: AOJu0YyFMVNnqf31PEaQ6UR+xp3lS8iZO20jD5zXpappv6HIIxL/6ZhT GD3XpYA26ZA9EMAeArGJ/l8WtblG3OAcnCkHb6o= X-Google-Smtp-Source: AGHT+IG8p/VYtEuYXEqfyf92qLk1u3ilKXfNk1bocvUmbDg/qP5JSDhh3w71/U6oHYh+e/blNmVl1w== X-Received: by 2002:a17:902:ce84:b0:1c2:218c:3754 with SMTP id f4-20020a170902ce8400b001c2218c3754mr7209083plg.53.1698522329018; Sat, 28 Oct 2023 12:45:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org, pbonzini@redhat.com Subject: [PATCH v2 05/35] tcg/optimize: Split out arg_new_constant Date: Sat, 28 Oct 2023 12:44:52 -0700 Message-Id: <20231028194522.245170-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231028194522.245170-1-richard.henderson@linaro.org> References: <20231028194522.245170-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::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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: 1698522436398100003 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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