From patchwork Mon Aug 30 06:24:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 504324 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp1526147jai; Sun, 29 Aug 2021 23:57:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAQnJPA6y+GVaUNKR2O7GcvlgruLWRuMm4S5YXTA82foMmFPqt2DLxI4zvqfMX+EQ92fub X-Received: by 2002:a25:2f0e:: with SMTP id v14mr9717964ybv.279.1630306679728; Sun, 29 Aug 2021 23:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630306679; cv=none; d=google.com; s=arc-20160816; b=k7FlbuYoKHtC2CGagCG7jFFNigygrXUWElgjuBxZsBqxaz2FAsJIgguZZZOmjIa6/U FEK4hwVQZz5wuGIBgmBxcdzS5zkOcoVOzYz7JRzc+iGrb6D9Bsqgz06DLX4b7XVoWeKy GUuVZg+Rk+1Td+Use1ROfiDyFwg79T2EdEJFW9IQqoLb+gdE6nV4DC/d0u1L9gjBTcjb bM1uCqNUNqK9UKg4i0eaEUZN+O9//i+4GFC95NrU1lSznwmaz/OLG54VYkj06K2ls/sH fJuUsPXg06gzizXTky10D4xhZmrCHIiuUsvIOWT9Mq1Y/t+5WoRVUi5phHIVjqEkTj9r Lmog== 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=HRy9ECrCXomzAwAjSMZ0wo8n5E+QDPpcqNFOCgo836E=; b=vPo2QxwfiT+RBX4pew7ZSOoxzB39toWwuAHd22pIbcm2gt8sJicakF6/mFo77hCsUS 3qKGuEw2UneoZUb7PEGzroLjmw4FYtjkCVcRaakQ+BcUb/pGq8H4fzimlRzrAofuRbpb UcrbiSyXggD/d5LViFOWsqH/7OnTmPcZT40urt5SDLkQMHxy3wJl4DSOZW/Sr5wpYZ45 7viSgM0qDF9jJjcHu9Evkbc/M5HTm0xWmiBydyQlZQXYWxTciKun12RKkOaffaylZPR0 PIpam+s2LUj5MBsO+/xEx1M/L5n6ZXtCzMWv61NPPGXTLJLFSaBbImXbU13suNv9ij1J Ypeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PGJF6B0j; 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 s205si10872868yba.199.2021.08.29.23.57.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 29 Aug 2021 23:57:59 -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=PGJF6B0j; 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]:59110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKbF1-0002id-5M for patch@linaro.org; Mon, 30 Aug 2021 02:57:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46492) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKajK-0004IS-2M for qemu-devel@nongnu.org; Mon, 30 Aug 2021 02:25:14 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:43970) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mKajI-0007cl-B8 for qemu-devel@nongnu.org; Mon, 30 Aug 2021 02:25:13 -0400 Received: by mail-pj1-x102d.google.com with SMTP id d3-20020a17090ae28300b0019629c96f25so6355381pjz.2 for ; Sun, 29 Aug 2021 23:25:11 -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=HRy9ECrCXomzAwAjSMZ0wo8n5E+QDPpcqNFOCgo836E=; b=PGJF6B0jcZcAPRkfFOmo7+QdT+XjTILJ++/V4IV2r9TyWDM8/oYWhVyU2l7yEn7Frd oRlPtOFmnsofsqV/KFFO/mO39EiH07ipppNwKJpXcGwcgHMjLyL/xw2RZvh/AUS5cbBt qRzb5/0t+N6FPyK6b+wlDEzi3k3CJpvpsZ1pqv8sXqYpReJnwdnebq5yvDDDGmsZtdBH b/yyHo8DrNt9X7uVZ3Dc6QcZAiwhIZyHjNQC3qP8phQXHuRFlBuisEpMgh9Gx8tw3gdW PtZojN8oijbhGQzKLOxDU63GzyOteRgmEwlKwOt2CX0nf8kKzjrVyE7owL109DUQbbQh 2VfQ== 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=HRy9ECrCXomzAwAjSMZ0wo8n5E+QDPpcqNFOCgo836E=; b=VwtjWZRTiKgyLixtx2vZFpRQ6I0Xdg9xV6zus4+s/wSzJw2UvToO3/o5cgnTWab4/8 XZd7GRabTG6sQhz7yqDm4xBVbZiO6AUs/8uSAHtGeszgqSsotknXoiZNQcP06YZiR+XI 6gGHlmbS0AYUJKeoVizoSOiylw7rLE/jFM6eGtz495gN9UjExP/BbpIJEPNZ4if4BY1T b544g2+MLFhTIqBBrUdOpXfsv9sDSG2ReQJVk8GW7+yHx3gV5gMG+pAE7wxtDkps3Vvj sK+5PFe8pWNweVptwNt7yxpM8hiSRDtSl4Q3iNV+aFBJsEkEyjuLCd1N6oPR0oeYWtvX QzEg== X-Gm-Message-State: AOAM5337o9XzdmSZXMRmZiVME8doRwF88xTo5ndCYsN1V1ob6MR6lJOF PCThKXUOtdAYXvfbDRaRIkb0EFBXVllTgg== X-Received: by 2002:a17:90a:c293:: with SMTP id f19mr4474970pjt.106.1630304710970; Sun, 29 Aug 2021 23:25:10 -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.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Aug 2021 23:25:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 28/48] tcg/optimize: Split out fold_dup, fold_dup2 Date: Sun, 29 Aug 2021 23:24:31 -0700 Message-Id: <20210830062451.639572-29-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::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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 | 53 +++++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 22 deletions(-) -- 2.25.1 diff --git a/tcg/optimize.c b/tcg/optimize.c index 1366bbaa17..1361bffab9 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -917,6 +917,31 @@ static bool fold_deposit(OptContext *ctx, TCGOp *op) return false; } +static bool fold_dup(OptContext *ctx, TCGOp *op) +{ + if (arg_is_const(op->args[1])) { + uint64_t t = arg_info(op->args[1])->val; + t = dup_const(TCGOP_VECE(op), t); + return tcg_opt_gen_movi(ctx, op, op->args[0], t); + } + return false; +} + +static bool fold_dup2(OptContext *ctx, TCGOp *op) +{ + if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { + uint64_t t = deposit64(arg_info(op->args[1])->val, 32, 32, + arg_info(op->args[2])->val); + return tcg_opt_gen_movi(ctx, op, op->args[0], t); + } + + if (args_are_copies(op->args[1], op->args[2])) { + op->opc = INDEX_op_dup_vec; + TCGOP_VECE(op) = MO_32; + } + return false; +} + static bool fold_eqv(OptContext *ctx, TCGOp *op) { return fold_const2(ctx, op); @@ -1718,28 +1743,6 @@ void tcg_optimize(TCGContext *s) done = tcg_opt_gen_mov(&ctx, op, op->args[0], op->args[1]); break; - case INDEX_op_dup_vec: - if (arg_is_const(op->args[1])) { - tmp = arg_info(op->args[1])->val; - tmp = dup_const(TCGOP_VECE(op), tmp); - tcg_opt_gen_movi(&ctx, op, op->args[0], tmp); - continue; - } - break; - - case INDEX_op_dup2_vec: - assert(TCG_TARGET_REG_BITS == 32); - if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { - tcg_opt_gen_movi(&ctx, op, op->args[0], - deposit64(arg_info(op->args[1])->val, 32, 32, - arg_info(op->args[2])->val)); - continue; - } else if (args_are_copies(op->args[1], op->args[2])) { - op->opc = INDEX_op_dup_vec; - TCGOP_VECE(op) = MO_32; - } - break; - default: break; @@ -1783,6 +1786,12 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64(divu): done = fold_const2(&ctx, op); break; + case INDEX_op_dup_vec: + done = fold_dup(&ctx, op); + break; + case INDEX_op_dup2_vec: + done = fold_dup2(&ctx, op); + break; CASE_OP_32_64(eqv): done = fold_eqv(&ctx, op); break;