Message ID | 20211029043329.1518029-32-richard.henderson@linaro.org |
---|---|
State | Accepted |
Commit | 30dd0bfeb5385342a7f216e661d9b69f6ec7182e |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp402786iml; Thu, 28 Oct 2021 21:57:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLG1hUHoAXoA9h3jhLCPOaWeObXP8DJz461Gd6d6FMNQUM/wjutdKd27tO0oLJ+BRm52Tl X-Received: by 2002:aca:1808:: with SMTP id h8mr6367268oih.54.1635483432474; Thu, 28 Oct 2021 21:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635483432; cv=none; d=google.com; s=arc-20160816; b=srWhCHOYCfO6YMC7YXmYr8KWwbFZRulDNVKG8prgmGzTDsD6Kx0AYGkjZtxh22TcSG YdQNCf2yD+UKVXwonqGhcXCf3Ze8WUz3ha4SGFz+Db/NfDP7l6WZAz/jbxgRcWsHH/hk T+OhFVPOy4dfNOUqnYbb556xIUGB6IGjn6VsVT/O6etiOglfH8S42SRHpobT4EH/jg1w H6JSdwaYkeFawQq6FGZcXd9EcjW2YIdTtYPSl1xg9buN9hCWVMK6fwkXi18sjljS4VXl enhD/RD5kbQV76FgIIyXAjEjjQJQigmYAlPThF3LQYtxNLmWtRdPx+PonLEQMRvOy/3S TqWg== 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=I6H+U1ruTrcwXeKIJx0xdeAaOvB86vmaSGOOcxgJmqQ=; b=C5PrfDJOa9RCfc/FKguBvvhsTRoP+USiQq5O0FrbQ/FjZBOXiCB7KhmQh5ML4B2if7 +DU6WfBHojFRMQxyAB6AdmolpP5ik254z49fqEIJ6Ess7yy5Z/VkK8LNNiOJFjyey+Va UULjOcrFMyGtgFcpT0glUMiXJYEHRwx4mF2vLt2DQi9m6kwmdONS117p6fee6Xn7ejyr O9/rK/Xi7wgBnloicGrZE2D7Ra5COhg9M8pThyB09+DIkMHN+mefOImZVuIOuzcr3lmk nKF2FdtzlII7P93d7nkh7y8vY9ANPZonl4LlmbEPVsA2ureS+yn3noljEHJCN1kurJzC MSRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vdgKXEMn; 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: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b63si4513959oia.118.2021.10.28.21.57.12 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Oct 2021 21:57:12 -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=vdgKXEMn; 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]:36862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces+patch=linaro.org@nongnu.org>) id 1mgJx1-00056Y-Ps for patch@linaro.org; Fri, 29 Oct 2021 00:57:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>) id 1mgJaa-0004cq-1s for qemu-devel@nongnu.org; Fri, 29 Oct 2021 00:34:00 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]:38903) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>) id 1mgJaY-0007zL-4Q for qemu-devel@nongnu.org; Fri, 29 Oct 2021 00:33:59 -0400 Received: by mail-pl1-x62e.google.com with SMTP id i5so6002977pla.5 for <qemu-devel@nongnu.org>; Thu, 28 Oct 2021 21:33:57 -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=I6H+U1ruTrcwXeKIJx0xdeAaOvB86vmaSGOOcxgJmqQ=; b=vdgKXEMngBBJJx9j/2pjwQBZ8J4++Heqa2KX/H8P4OzRWmo+r57B8fbBePCBzWLMd5 3tu5gKuODPKNnBTAmk/Wvpk0wO5AXhKwqlJuCyfgogxP+78v0RvkyMA3YL+Lof+rvqLF QNeZ7ski5f7Nlyo+orZp0r7WZuuZ9Vd/m0yI1ApUmM7/OeZgwqE7suLY738hq/bxKYWb Qdkm4QESlIJIAJNRdUXd6zMLi6tXtNsweeR3KvRVXuMtpAliy8yY8ElyYPopLr+4nW7O Z95qERZ0NSoCr6zw94QY7H4UqtG6DOMGYb3Dzf6b475pqMAE+GA+aAGx8GkxZptjM/cl IgNg== 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=I6H+U1ruTrcwXeKIJx0xdeAaOvB86vmaSGOOcxgJmqQ=; b=AI2H8WpnmZzZtT4GISTYu2qF4xJzrwku84d34yKN6Y0jnd0muqUvyaDMMgWzUhcUbW 2pT9toqJ1SN1vZpe1mOgtGzZ8fGEPPR5q/MF0qZ6mRN6ssWWrRYFbwzNiYhYlq2cQfmp FdG1sb3gTkcBpw+kJBhjutjajodEvy3ZV9Buw0JCbg7gXQBSa4lKtf/c8IcJkl/i0EMy QKdLByZY+TQqzCnW002PH9VEabsXb4Y42eH9GYexFrlVTOyCWg61JIVvCin6na30lF0Y z8W0cKxw86bYPbch8fu7Xpal9E9BxmrLetNsK+9URO6BbHeaV3FEXIyRmLQljahEGcqL MGew== X-Gm-Message-State: AOAM532z/2TyJUqeUkIU8bUt6jLnj+QLaFeHUc/j2mqUaK5RnKO/Phx5 VayrZnDQGayCXr7aCzFlZjUy957nFAft7g== X-Received: by 2002:a17:90b:164b:: with SMTP id il11mr17504966pjb.98.1635482036879; Thu, 28 Oct 2021 21:33:56 -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.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 21:33:56 -0700 (PDT) From: Richard Henderson <richard.henderson@linaro.org> To: qemu-devel@nongnu.org Subject: [PULL v2 31/60] tcg/optimize: Split out fold_count_zeros Date: Thu, 28 Oct 2021 21:33:00 -0700 Message-Id: <20211029043329.1518029-32-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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: Luis Pires <luis.pires@eldorado.org.br>, =?utf-8?q?Philippe_Mathieu-Da?= =?utf-8?q?ud=C3=A9?= <f4bug@amsat.org> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patch=linaro.org@nongnu.org> |
Series |
tcg patch queue
|
expand
|
diff --git a/tcg/optimize.c b/tcg/optimize.c index 2c57d08760..dd65f1afcd 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -873,6 +873,20 @@ static bool fold_call(OptContext *ctx, TCGOp *op) return true; } +static bool fold_count_zeros(OptContext *ctx, TCGOp *op) +{ + if (arg_is_const(op->args[1])) { + uint64_t t = arg_info(op->args[1])->val; + + if (t != 0) { + t = do_constant_folding(op->opc, t, 0); + return tcg_opt_gen_movi(ctx, op, op->args[0], t); + } + return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[2]); + } + return false; +} + static bool fold_ctpop(OptContext *ctx, TCGOp *op) { return fold_const1(ctx, op); @@ -1739,20 +1753,6 @@ void tcg_optimize(TCGContext *s) } break; - CASE_OP_32_64(clz): - CASE_OP_32_64(ctz): - if (arg_is_const(op->args[1])) { - TCGArg v = arg_info(op->args[1])->val; - if (v != 0) { - tmp = do_constant_folding(opc, v, 0); - tcg_opt_gen_movi(&ctx, op, op->args[0], tmp); - } else { - tcg_opt_gen_mov(&ctx, op, op->args[0], op->args[2]); - } - continue; - } - break; - default: break; @@ -1777,6 +1777,10 @@ void tcg_optimize(TCGContext *s) case INDEX_op_brcond2_i32: done = fold_brcond2(&ctx, op); break; + CASE_OP_32_64(clz): + CASE_OP_32_64(ctz): + done = fold_count_zeros(&ctx, op); + break; CASE_OP_32_64(ctpop): done = fold_ctpop(&ctx, op); break;