From patchwork Mon Aug 30 06:24:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 504308 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp1518853jai; Sun, 29 Aug 2021 23:43:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwirdw72TEHv0SjTYESMHdG7aYNsG1Y/BeW3NKi/zaQeouqBqsA0xyuwkaEsQBKT2o/enRx X-Received: by 2002:a25:b941:: with SMTP id s1mr21101170ybm.304.1630305810352; Sun, 29 Aug 2021 23:43:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630305810; cv=none; d=google.com; s=arc-20160816; b=eW8MxPOGAkDv9CCm6bOn11cSEZWitSq4Ukh6Ikk5Q1Kat2UG4wMm/6T4TCBIHFYVyc ky5WtlihBUOJnfF/F6T2sly9CG5XAyYgQFTxXE0uXKWTweeDWML/+sNgKMffjE2mfTxT 9ZcKPbUtv9dFluNsIwfEBADYHKmNgWF+a7Hlyn++Mc/bAHLjOXa5RWKWE/f2dHW95qSo L9z/Oo/0UI49aYNlac7G9aVTG0qKC4njYQBLRKn1kB/l7z3FUM+pgdoYYnPbU2SP4nEp WdPAFUPuzttTmRrCfbVPLrjLulhDdobE/kyJKDRbrRCfPQiN9QDf1ZJhRrkCFEOsfqTZ untQ== 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:to:from :dkim-signature; bh=0DoFoew0hKEmbikaFApG2+9yC/XMW8EHMmAnrdKl4KA=; b=xlFPryZECyCv6TkuZBJ3Fs7kDfnEr/lr6GjTjnsS+gnNsq8wzptzDby3ik65SNOuhj H8tPPcEGq77nUaSamBqSzJe+GjM1I4CtC2IE2n90PKc8MHoJzjimekTPAYoFChwvrIBq YYER3BaQuzmDF/HTsP3iB8w+8mYmIKLrvE9g3omjUpqR1xyc8D3azRT/yn/SBkUNdrD5 NUyvmR0oOLEWWUDS/2Usv1jiwMRwgKzsoxe41fox6EHU/D+BAMoAjtzuU/9bIeWClteH 4q/CuxG4I8H0tf1YDfl/Uk/Tjs6jGYY0b7tRKzvmJQXni9tyHURdSYsGbZgJsHSTo0hw DyYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oyVEH537; 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 v4si2286882ybp.116.2021.08.29.23.43.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 29 Aug 2021 23:43:30 -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=oyVEH537; 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]:48268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKb0z-0001hu-QZ for patch@linaro.org; Mon, 30 Aug 2021 02:43:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKajE-0003zX-8N for qemu-devel@nongnu.org; Mon, 30 Aug 2021 02:25:08 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]:40893) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mKajC-0007Xr-RF for qemu-devel@nongnu.org; Mon, 30 Aug 2021 02:25:08 -0400 Received: by mail-pl1-x62e.google.com with SMTP id c4so7921481plh.7 for ; Sun, 29 Aug 2021 23:25:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=0DoFoew0hKEmbikaFApG2+9yC/XMW8EHMmAnrdKl4KA=; b=oyVEH537hQWAh9QSiwrdGQiP6s+mo31f63Whrul/MG58ikeUa0BfVGeDDw+xp4sIls jRZ48tlV+7xwpGvGscLnZfOMNd2+hrG774F05ufbTHGDaiwAq8TwzuLvaK4/gdGKxU7y z56fTMaCLp/2jUYPlWaStRfXwvK1mu0HWH170Ija/st6Lb5R8Uwl1s/6p0ttyO9wncv3 j998WAZnSTfk9oBSilnAYij8V/G2m3zxGdzfEAMTpBepwRV90h8/qpOXxuMeAZsWs8IL i+9oUrZEcviWLXv7EKaV3vw46TG7k4LTVQcqqnbteYbmzsl5dk8TdFtXw2yf0P7zCkuV +d2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0DoFoew0hKEmbikaFApG2+9yC/XMW8EHMmAnrdKl4KA=; b=IW8e9SAnbYsgbjLEbXBClviyk96wSs6QqIbyDYFNfmHUzfaTaj3WtffXrqqG80mHBS 7Nef2tVZ3K0ggFihaXQRkIw4PKlFVoM30+k8xoaEXIXPF7wx4uQ+jlPf+LjrsijKiGd/ rFVbp1C4dsXRMh2/1hecP95/aZOp+N0QuOXkibfeBOMF3zamuoB8lHThLfHvRDvL6gt1 YvagfbMO+ba6vF0JTvGX7kEShAKxlBN4bvAUld/42FqedN2/Ke/9BCp7f4hMgNmJXgUi O4sNLZqWCg+WhihyaW0SPkRMUMAJHqT3H7qp3ckb+Ngv3j03soEQf55G87h60WW8kJlL sM7A== X-Gm-Message-State: AOAM530Ja+ZXfEBvimLJkItGy7o/aZwPm1JPpwjMhEl0pgR8BOjfCtkG OF8laDDlRuDletIiOVxFMfauv3VhwaLXeg== X-Received: by 2002:a17:90b:a4b:: with SMTP id gw11mr38372490pjb.227.1630304705448; Sun, 29 Aug 2021 23:25:05 -0700 (PDT) Received: from localhost.localdomain (174-21-72-39.tukw.qwest.net. [174.21.72.39]) by smtp.gmail.com with ESMTPSA id b12sm13942084pff.63.2021.08.29.23.25.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Aug 2021 23:25:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 19/48] tcg/optimize: Split out fold_setcond Date: Sun, 29 Aug 2021 23:24:22 -0700 Message-Id: <20210830062451.639572-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210830062451.639572-1-richard.henderson@linaro.org> References: <20210830062451.639572-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 9dfd172a34..58f03737d2 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -935,6 +935,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]; @@ -1635,15 +1646,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]); @@ -1802,6 +1804,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;