From patchwork Fri Oct 29 04:32:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516399 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp400941iml; Thu, 28 Oct 2021 21:54:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfxU3dWW0sdQEInMFM+E6cw6qABaJI1OP/7ofPJEcuz4BXGczhKjTLaNE2HCC0E/evhs3S X-Received: by 2002:a05:6830:3101:: with SMTP id b1mr6827217ots.291.1635483257502; Thu, 28 Oct 2021 21:54:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635483257; cv=none; d=google.com; s=arc-20160816; b=FzJ4Fa3QKG6Oss3r2QFlr1t86DxGuKSoDXlZy6LV/h6CFgr50rCkVM+BT0bsoISKRT GzjgZDUCk0SP5L0sU9lw7c+FMcwt7Lq4v5NiT48kyjTDFgyIUaPFEP4P18HQAk+Wm3Mr xAXG4z4VgVsrbKreDodbmGb/2sZjRvYqid6fEvSW2WHbH9YnwrcrBcPqqARnD+yPZ7aS V7OdJlzi3sUpJQhfeMYpQQ9dop8sA00Q7INVpkOU1BMlAaKSEjaKFZ8pQMPn2RrE8ojc rWgJRW72/5ZaLLkNfiw/WdOVyV9zLioxyoW+Ahrwn1AUIgwNTzFpyz+39F2XNbf6iwRZ gZSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=CEAmAjtRAA8VTRQA9Y1dByLl7XumxO8Ow9/VzdNZDew=; b=Il8pazYSTYj7++VJoqrXrC25JT9HIDRDBL3wPQXMymmwve/JWwpqRFEBqrHERudls2 zNOGp6RvMU9Ag2gGMpA1KqdmbAluuEbrq8NxcSipaJSmrmF+9nZy+gmlSPR/Qe3Ij8pr lDhftQrM6rLWhFWBLpbuDFfFGlM/KW7t2SwCcucXIoj9cGnvYUJacEBc4dzK61M2y+lD PvALspB+NlbX1rkUl6gByRoy3v/SQ+BVhSOf0N7gaCa4xB470Hdm6ZfT3RMdMIHTLmKs RGYx/1vZAzerPZXn+dZG95ExjU1f3NcezHhEPo14pfSzUjdzYHK3LEePk6x3GXAc1+Pn Uf0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jcemJCA1; 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 q19si5637799otn.296.2021.10.28.21.54.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Oct 2021 21:54:17 -0700 (PDT) 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=jcemJCA1; 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]:58668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mgJuC-0000cO-PD for patch@linaro.org; Fri, 29 Oct 2021 00:54:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgJaW-0004O1-6F for qemu-devel@nongnu.org; Fri, 29 Oct 2021 00:33:56 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:37442) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mgJaT-0007yH-Gu for qemu-devel@nongnu.org; Fri, 29 Oct 2021 00:33:55 -0400 Received: by mail-pj1-x102f.google.com with SMTP id t5-20020a17090a4e4500b001a0a284fcc2so9647722pjl.2 for ; Thu, 28 Oct 2021 21:33:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CEAmAjtRAA8VTRQA9Y1dByLl7XumxO8Ow9/VzdNZDew=; b=jcemJCA1dshd5Jh2/buSAru7aAjoGMu8+q9lgcr2AUwSWqbCOOQSsrGc7YSQim7Jbj PVpGoDc1dDE/pdhClz5JQfvdGmXohPid6NmV/4kojUiQmepBxSToMDuyLo0cM/Y5ArGw laA7lmZc0MzCSCNdjy9+BersWCu8dkQFopTehp9RXVEONRKZRaD8Acd9j+COb8G1Gl95 LCO2vvrEU6L+cvonpC0gCpXpa+sIi+ZgDjPtQqJx7jRIQo8P1m3PlFVZj9to84TWRqbG 7VzHgg57pd5jqlVpfu9j8BghNfawLsviB9FFuF2+uPs/CZjoCPJCxwGVfiNU748inE1a cQ3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CEAmAjtRAA8VTRQA9Y1dByLl7XumxO8Ow9/VzdNZDew=; b=SRtj7jN9B+iGK36PoOPEsje351m+yyMv1AHWqEfrpCicRjaNLCplAPRhf/Ip4TYIiK /4mbRSjLfKYq+vszXdEFh751nzfoJMGobKHzwKqHulCeNVLxATePYXmSLtoooYtwpxsU GaBrc5ghaoCPQZ14sRyURm0S/x5MzF8jj3NK3KNTJ3YuVOnznea8cfibQmlSRoEfGlbj qFqoLptBFaWdAD5POKgo2HcSx6vY6tp8P20tktJ7Fbi4znJUu/kQV4KCfYKOvCAVB2p8 vWcqDhZPBoIDw3iOtRpYKD+nERefafziY0daWZ7T1e6W7P/g+S/Ucw2ka2Z+LzGyF3dZ Gysw== X-Gm-Message-State: AOAM532Adh0EOExIcSuRqSz3PoNG2XUpui+44lzM8J7owep0Qz2FXyFt rirfpGhWXiSLlf6VhxM8zCxQgsrjhqt9xg== X-Received: by 2002:a17:902:6b86:b0:13f:8d7a:397c with SMTP id p6-20020a1709026b8600b0013f8d7a397cmr7959483plk.50.1635482031172; Thu, 28 Oct 2021 21:33:51 -0700 (PDT) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id i11sm4120257pgp.18.2021.10.28.21.33.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 21:33:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v2 24/60] tcg/optimize: Split out fold_setcond Date: Thu, 28 Oct 2021 21:32:53 -0700 Message-Id: <20211029043329.1518029-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211029043329.1518029-1-richard.henderson@linaro.org> References: <20211029043329.1518029-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Luis Pires , =?utf-8?q?Philippe_Mathieu-Da?= =?utf-8?q?ud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Luis Pires Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/optimize.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) -- 2.25.1 diff --git a/tcg/optimize.c b/tcg/optimize.c index 24ba6d2830..f79cb44944 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -948,6 +948,17 @@ static bool fold_remainder(OptContext *ctx, TCGOp *op) return fold_const2(ctx, op); } +static bool fold_setcond(OptContext *ctx, TCGOp *op) +{ + TCGCond cond = op->args[3]; + int i = do_constant_folding_cond(op->opc, op->args[1], op->args[2], cond); + + if (i >= 0) { + return tcg_opt_gen_movi(ctx, op, op->args[0], i); + } + return false; +} + static bool fold_setcond2(OptContext *ctx, TCGOp *op) { TCGCond cond = op->args[5]; @@ -1648,15 +1659,6 @@ void tcg_optimize(TCGContext *s) } break; - CASE_OP_32_64(setcond): - i = do_constant_folding_cond(opc, op->args[1], - op->args[2], op->args[3]); - if (i >= 0) { - tcg_opt_gen_movi(&ctx, op, op->args[0], i); - continue; - } - break; - CASE_OP_32_64(movcond): i = do_constant_folding_cond(opc, op->args[1], op->args[2], op->args[5]); @@ -1817,6 +1819,9 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64(shr): done = fold_shift(&ctx, op); break; + CASE_OP_32_64(setcond): + done = fold_setcond(&ctx, op); + break; case INDEX_op_setcond2_i32: done = fold_setcond2(&ctx, op); break;