From patchwork Thu Oct 21 21:05:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516080 Delivered-To: patch@linaro.org Received: by 2002:ac0:bf50:0:0:0:0:0 with SMTP id o16csp335592imj; Thu, 21 Oct 2021 14:19:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzT46HAkCYOC+/e8Yep9aQN8iFKQMjHj1ECfWIn8pJgspySCv9RI/KLZZpza3KXVp+JqSzB X-Received: by 2002:a05:6820:1015:: with SMTP id v21mr6224029oor.47.1634851141091; Thu, 21 Oct 2021 14:19:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634851141; cv=none; d=google.com; s=arc-20160816; b=rsxIczQYHLZTmIBCiIHKEr8kWg2Zb4UsspWd8eUWZ46u+tQ6trfGaUqq/J/1UDJfmM /xRd9G8xKFIC5a4JFjqA0tzLQ/AW+nxnVi+kBE1cKRz3a207KI/OMoeTzTgBHgDUgjBL Sr5uW8RwLQIJNd9xL7UO60sVj5f4rraGfL56VXOLtfrqzvUfeTnnFjT4pajKDh07v1wO Q/qPReb7yTK+w2pZWyZacs0hJ/1m1DlPav6EFP31yIeoPG9rPZRgfRyCGwsaIT/B3PgL WwDHm/6MBFmWMepvwZuVCGBq+zwKkiaJvcZCsyWHz1/7YwyFgrgnPC6DZqW4VHmuvybL 0hQA== 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=oO+3JjESjP15t2fk2EDQgBB6bUdwG1Yt7W+t+rnnIlU=; b=VlH0UIFW/xPnRh+uftCNfus2B23s38zJtPjxMpEI/T7UxwE0WXTztW7M4P2Hmt3tVM GmTnwvb2vWU5Gx/+8kTg59E3nxYDhZfrmXdgsrcc3UVzDrFHIZqjcswTRLTezeyYcyC4 AT7Tp7FD3Vlghwt1o9g74OT+j0rbDEuXxnOX/2eKYGOW3EoyR3HDrn8bXYxTJtZAmPRD XD9AU47BLxxo8A2eKrPgmvPmeSOG4VQGoRRMxlvI9H1w3unt5PsFrU+ycEqjJw2+krGL QJsCT7UcMm470jbhxyQz50YRF4+e4AID9E2o8dO9z6M2z6l7LZpF6PnPFn9HTJwxuppA +1wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="NuTGg6/z"; 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=fail (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 o5si6827118ota.13.2021.10.21.14.19.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Oct 2021 14:19:01 -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=fail header.i=@linaro.org header.s=google header.b="NuTGg6/z"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdfSm-0000OW-Ff for patch@linaro.org; Thu, 21 Oct 2021 17:19:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdfGE-0007YD-DX for qemu-devel@nongnu.org; Thu, 21 Oct 2021 17:06:02 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:42603) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdfG9-0004JX-E3 for qemu-devel@nongnu.org; Thu, 21 Oct 2021 17:06:02 -0400 Received: by mail-pf1-x42e.google.com with SMTP id m14so1745159pfc.9 for ; Thu, 21 Oct 2021 14:05:55 -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=oO+3JjESjP15t2fk2EDQgBB6bUdwG1Yt7W+t+rnnIlU=; b=NuTGg6/znWoSQa5QPJw/20kNHuUgbH2FP3CauzK2J/rNmKyOIV7VczbcaUeCU15aXv hOtv8pctXdhRRj1cIsljWasOMQ2uKQZZM9neRdhD19i/r9qYlrnWNTu+TCn6CLXyZkei ozayouaA+QwCw0luwEp7q5QZzCOxr9VFy9hZes1F7H5ZHkECoCluUCkODjWf2snoNA/V 5FnxIPHxOqsyV9keUqL/KGpCjbUhiAFCk6tum4mxxhTc/ZsgJq+3qmRpoxTfqf2zTOpz ac+JDa9XVtCwJv+eSg3jCSlPnFWcFhyCKHx0mCEcNLgfimRN6thEVLsgeIvjzELETUEo fQAQ== 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=oO+3JjESjP15t2fk2EDQgBB6bUdwG1Yt7W+t+rnnIlU=; b=PhfmQKi2qB7JE4O1d2KmsBM9Y7Muc8xIPaz4wuKtsRapm4rUgZSLRXZePyLz71Gqhw FW9lLEufqQzxdvDXXzMubhOZPN1wjmfqlEHjSXTpm/KSXqaM8KNFDrjd5fMHXYPx5HI8 mUc6ggnGPYuyPgKrutnCcw4BoaHAPE03aoF0g6ij4+4yndYG2eLXiB7v7ej8vf5ugAhe 7BZKLjoahFUnVsLrGlPVtaKjQi73g7ZTerhD4C4YxymE8RKQjFBjxZddpzMCtx4i15wA Ns1/Z+KrSX9cSgu0SINVzPtpyCXQGVrVGcpNhgih6Ltu8MLZJq+Z2rDYf7et/kOw1uuV +6Uw== X-Gm-Message-State: AOAM533ImGDabfpAMHG+gxFKTnsC5GJWNZHnAg2iq6sMEd+XPop7gMq9 AcQMTgRZoaI2QlC/zjNxt9P51w9nF7ui6Q== X-Received: by 2002:aa7:9258:0:b0:44d:4f03:6a7a with SMTP id 24-20020aa79258000000b0044d4f036a7amr7866184pfp.33.1634850354550; Thu, 21 Oct 2021 14:05:54 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id g7sm5981670pgp.17.2021.10.21.14.05.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 14:05:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 19/48] tcg/optimize: Split out fold_setcond Date: Thu, 21 Oct 2021 14:05:10 -0700 Message-Id: <20211021210539.825582-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211021210539.825582-1-richard.henderson@linaro.org> References: <20211021210539.825582-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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@eldorado.org.br, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Luis Pires Signed-off-by: Richard Henderson --- tcg/optimize.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/tcg/optimize.c b/tcg/optimize.c index 9059e917cf..2086e894c6 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -933,6 +933,17 @@ static bool fold_qemu_st(OptContext *ctx, TCGOp *op) return false; } +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]; @@ -1633,15 +1644,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]); @@ -1800,6 +1802,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;