From patchwork Tue Nov 7 02:48:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741751 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1414978wrr; Mon, 6 Nov 2023 18:51:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHiF2JeAOiXS9DTNakEmkI3p/+epfTMLipvt3pe0CFnixIbZCEENF4rmsxKZ1qbk9GYK2dl X-Received: by 2002:ac8:5cc7:0:b0:403:a9aa:571f with SMTP id s7-20020ac85cc7000000b00403a9aa571fmr36605154qta.16.1699325477430; Mon, 06 Nov 2023 18:51:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699325477; cv=none; d=google.com; s=arc-20160816; b=DB3Wt6GIpqTtGX5khQDm1UHskqwlO9ibesagOw5AHoiYngSOh277lFqyTzj3LFfGpQ leJ/8QCxar3z5W7FisHw3PA41l5r9upQRxxOFCkdsDcTtd4L+zD7JIHNE5dxG3TE9iEa osoAegjt0iJcbrwADulQuDu6+LVAU0iW4mvS8CuJp5NlhqKcMdhvrFp/bgPerD5EtTex PsVRhTN7z64mHOwCc2P0XwEE5vc7WGtMexmoEG5tP4RI5N1Q98yvT+r/YHhMF/Xuu8TA FBpSg8KB3uBPlUri29ygFyaeABWp8LBe3CAcPW0XDagcjXdzPwmXUsChfcCLzDgffE4Z VDgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=N9z9UDH6HsfK3PAJgBAA8lIx6YK0Bl0hMEwM1O6FOrY=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=vC+vAWS62yTIPPODBR/ZGTfOSd+ZJ6MD0DSzhsSjOejzjcu+4mAiDavCw/XcdEFbWY ByLdtqMry16AwtpLXJCbSBHNAmvJBPWKAJvJYfQXpHHkyjyC6se0LDfE/0q83YNUG0EA 3YNSls3N6j1Ix18UUujDLe/5vvRSvAR34e2XPXPrQGUl8H+LQCFMjuoPSzruPncWR4dl EQUdp0KrLiZMMOLLlCKzMDZ5CaKbEuHmp6RcvzC1IEW+o1m58ICs1jtaJhnAvFt3xJa+ F5DiDcf0c7vVjVioUqDWewOwhcQLP3DyUuugJ+uouRf0bzEvqhypG6f8H1rE7n5F3E8d VspQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GQKCy4Yu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t17-20020a05622a01d100b0041822c32e38si6578075qtw.511.2023.11.06.18.51.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 18:51:17 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GQKCy4Yu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0C9R-0008R9-Rd; Mon, 06 Nov 2023 21:49:13 -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 1r0C9P-0008QC-Hj for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:11 -0500 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9N-0005wL-R3 for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:11 -0500 Received: by mail-ot1-x335.google.com with SMTP id 46e09a7af769-6cd0963c61cso2754785a34.0 for ; Mon, 06 Nov 2023 18:49:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325349; x=1699930149; 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=N9z9UDH6HsfK3PAJgBAA8lIx6YK0Bl0hMEwM1O6FOrY=; b=GQKCy4YuJoNAAjQcHm0ecWe1WoFU+TBJVOUM3IFo8WGphCMo3kIxd07WaaYb0k0T5l ETF5NrXR27gxbAjHNcjylBKlbxMvKeSATmFJSRAlmsWYKvwLyXMEJTOA2DVVfHr45KUd IhFlEzd3L3rFTI3DCEuyHPwn+vFSXNCmi2cIAGCIbXnDOQDBj92TXIzGpciMqDVLsblk TG9cSOVINX2IiImZDCX3nTSq6v5sIvMQQgcejBGYuSVSWLmkuXI2Nxc/SiUuxFK6pBTR j8jHMwncLPdOIbYbb5rt3FIPEjC1i42noZiGyMsUUd53qxW6lGKlt+AtSLWlBgK4SE7D pyIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325349; x=1699930149; 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=N9z9UDH6HsfK3PAJgBAA8lIx6YK0Bl0hMEwM1O6FOrY=; b=Dv3O8LGq0aPpbDOXLc9mj50YpE7jKU3108aDhsi6QA7Db8JBZFjt8D5nwaiJ9B23LP yB/vJHFZDvg7VcjNXY3zfr/dQm0dJSrVZMzYgAjbv4tnjhpxyDDTTUkxwBCSyV+S4Cb0 zfXflCzXNGVU/G4ggu2nbJ1LHmnptQ0G/P6NXk4Z9We1mSsWJabFbysvn+GMvCMRcrC3 atNzwSq1gEOHeZS9b2IpZ5wBhZeiuhXsKk3E6gGhY+BzS4e8RnowEyFGtAQ+6MDSsEJ2 hJkmUYMOqmGq7yG4syh9Z3bYVmjlol3dZHpMe+q80oomTDBBweKWTNEzBvU0Ov1v4iQV 4StQ== X-Gm-Message-State: AOJu0YxT94pSktKFTNp/19rxb1m46G0a5Qd36X1mGwBWlYUmdJCBvZ70 NhaijHk//Uj7h8jLzjh+pmKWc8+OKjn0l+eb4Mc= X-Received: by 2002:a05:6830:3149:b0:6b8:dc53:9efd with SMTP id c9-20020a056830314900b006b8dc539efdmr32406598ots.3.1699325348783; Mon, 06 Nov 2023 18:49:08 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.49.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:49:08 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 31/35] tcg/optimize: Split out arg_new_constant Date: Mon, 6 Nov 2023 18:48:38 -0800 Message-Id: <20231107024842.7650-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::335; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x335.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Fixes a bug wherein raw uses of tcg_constant_internal do not have their TempOptInfo initialized. Reviewed-by: Philippe Mathieu-Daudé 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 a4fe9ee9bb..d8e437c826 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -338,6 +338,21 @@ static TCGTemp *find_mem_copy_for(OptContext *ctx, TCGType type, intptr_t s) return NULL; } +static TCGArg arg_new_constant(OptContext *ctx, uint64_t val) +{ + TCGType type = ctx->type; + TCGTemp *ts; + + if (type == TCG_TYPE_I32) { + val = (int32_t)val; + } + + ts = 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 = arg_temp(dst); @@ -399,16 +414,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 == TCG_TYPE_I32) { - val = (int32_t)val; - } - /* Convert movi to mov with constant temp. */ - tv = 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)); } static uint64_t do_constant_folding_2(TCGOpcode op, uint64_t x, uint64_t y) @@ -1431,7 +1438,7 @@ static bool fold_deposit(OptContext *ctx, TCGOp *op) op->opc = and_opc; op->args[1] = op->args[2]; - op->args[2] = temp_arg(tcg_constant_internal(ctx->type, mask)); + op->args[2] = arg_new_constant(ctx, mask); ctx->z_mask = mask & arg_info(op->args[1])->z_mask; return false; } @@ -1442,7 +1449,7 @@ static bool fold_deposit(OptContext *ctx, TCGOp *op) uint64_t mask = deposit64(-1, op->args[3], op->args[4], 0); op->opc = and_opc; - op->args[2] = temp_arg(tcg_constant_internal(ctx->type, mask)); + op->args[2] = arg_new_constant(ctx, mask); ctx->z_mask = mask & arg_info(op->args[1])->z_mask; return false; }