From patchwork Mon Aug 30 06:24:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 504315 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp1521869jai; Sun, 29 Aug 2021 23:49:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9JcVnErUORnjr9H2lyVPXlLtnKpsIerZKagQrHeaztQe9Wogf8JoYmmFSjBjQFdkGCT+l X-Received: by 2002:a92:c56b:: with SMTP id b11mr14518065ilj.225.1630306148931; Sun, 29 Aug 2021 23:49:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630306148; cv=none; d=google.com; s=arc-20160816; b=0AZ7bmRNqXHpZYoYKfO+zWZo/kdoHzt279ux7Bt3Mhym8nFKBECJYBvEQp2r3c3IQU LuAoZ75Wr3dsCVCKr7WOpjfL83EGWeN5gJ/tLbCYPlquhVZxBGyBbPr+xo8PCRs6YmSr 8lf2gaq3LrbQluVzpUOhEDtTTTU4F5VeMjZj80OTseunBb+g+UsQO3IEduH6EbwQX6FW nu3PKflKTnSzD8k61HNv+D6WNPxxjgH+TwNuYPEPfLr7bNA1gVwVyrJXmbxH/6qo7EXQ sZq+qeGX+dOOtIdGzAewQEphNGzCrtiWrEM/WTMlAKSiRWnUe1Rber5djMJ3+uasVmIL 6Buw== 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=f2QT45/ZsA0r+h9boohgTz+Sf/VySauzdb86Sejv5n4=; b=StQHWnJylrUO0NhMH0jTE1ziTlmzrbR1rXLaG4UeymgeUD+tUAuknwr2ggLt7TKYb5 51eefmAECYJsfMAnAIemn4Cbtdu9XVrlOM2O+zsuBCN3mv3WbAtZw3QFf9rugytXVusc vFFoCMpTuzBl4AbH4xrt1wTWd2KMRBF5grC6HsgoEP8aNtuyZqxlevGr514/UGoMKhGb eByLf9jpF1M8PDaFsV7nwF3BYJ6QPdbn+6eK7DwmKYFaBguF3r6yJKRp/ldO+uN59whP OHzo9ZZpdqbzX4qwJHNW86kRIYzP/1ooMMoS+hQs2msTYdXRzeMc0lG/NTgt/nFtvuf3 +PGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pu85NODN; 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 r195si3811262ior.17.2021.08.29.23.49.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 29 Aug 2021 23:49:08 -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=Pu85NODN; 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]:36974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKb6S-0004jw-Bs for patch@linaro.org; Mon, 30 Aug 2021 02:49:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKajI-0004Do-BB for qemu-devel@nongnu.org; Mon, 30 Aug 2021 02:25:12 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:43977) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mKajF-0007aX-QP for qemu-devel@nongnu.org; Mon, 30 Aug 2021 02:25:12 -0400 Received: by mail-pj1-x1035.google.com with SMTP id d3-20020a17090ae28300b0019629c96f25so6355310pjz.2 for ; Sun, 29 Aug 2021 23:25:09 -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=f2QT45/ZsA0r+h9boohgTz+Sf/VySauzdb86Sejv5n4=; b=Pu85NODNSjqxzJfVKxTTecrRR89YSEtFBFOA9fPLsFWxPFkMcs2FqBYbbSE2yA2wj1 GoD/s8E3idiA7HOATicmlkIKY9x7vueYEgBvoVepVlm6Bc/matZMq6zZo/HzDwHA9IEX E7RDWsyzFS0sDXAWfQTN5Z3KBUw8wa8YNdPp1jXQyhZwHi6oqNX1CIEnUo1OzGu8yjD3 tDYK8mV16yi8zv2Eb/FNtRPz8MDssWxNPQxBGk33diBqncBow+p2sATRv8EMGuEmXS84 K0LvQMH+G5dp1I55xkYtEVLJ2QoXVI8D3XK2+vpkFZcJ4cMqCTU/rl37mEMS57l9zqwz HW4Q== 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=f2QT45/ZsA0r+h9boohgTz+Sf/VySauzdb86Sejv5n4=; b=J3rYMUAKLhZKPenDIboAfNSkfIpASLrSE/C9oSLjl+LeSdDiwJQsNw4qGkV8hzvMNI kv8+XLnIfIDX92N0eNJrtqv+5AGJYLLmWWGgVsLATyUI87IFKYek7/IxWQL9BUAHgIJ6 517E06OKaq9q+iSebvikBDnyDfzb1j3zWL/C6p04wl1zNqEBQKA7/+NU2AvooWrZvGZd NhFJUj9YhNE9vGAj+1qganlu9L/LHYiNJfwUoWqjRnZQ+N4WDUO012HlJx4N37xxyfeS 7Z8Ei4NQxcIqjps7TjhwhjV5IGf+xmdBC45WOoHO3WTQ1x+nRMB1okzOoOmpeibDIwMx iRvA== X-Gm-Message-State: AOAM532L1OjJrPB+eq/FRco/xlJHMCdQ0GlZcxyqBM6V67kPaUtKttkT PKBPIqgOjiE4Vg/13GghQeAvGVmG0Q6UWg== X-Received: by 2002:a17:90a:6b4b:: with SMTP id x11mr25290498pjl.157.1630304708537; Sun, 29 Aug 2021 23:25:08 -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.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Aug 2021 23:25:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 24/48] tcg/optimize: Split out fold_extract, fold_sextract Date: Sun, 29 Aug 2021 23:24:27 -0700 Message-Id: <20210830062451.639572-25-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::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) 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 | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) -- 2.25.1 diff --git a/tcg/optimize.c b/tcg/optimize.c index 866b77dad8..c3c66a949e 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -885,6 +885,18 @@ static bool fold_eqv(OptContext *ctx, TCGOp *op) return fold_const2(ctx, op); } +static bool fold_extract(OptContext *ctx, TCGOp *op) +{ + if (arg_is_const(op->args[1])) { + uint64_t t; + + t = arg_info(op->args[1])->val; + t = extract64(t, op->args[2], op->args[3]); + return tcg_opt_gen_movi(ctx, op, op->args[0], t); + } + return false; +} + static bool fold_extract2(OptContext *ctx, TCGOp *op) { if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { @@ -1113,6 +1125,18 @@ static bool fold_setcond2(OptContext *ctx, TCGOp *op) return tcg_opt_gen_movi(ctx, op, op->args[0], i); } +static bool fold_sextract(OptContext *ctx, TCGOp *op) +{ + if (arg_is_const(op->args[1])) { + uint64_t t; + + t = arg_info(op->args[1])->val; + t = sextract64(t, op->args[2], op->args[3]); + return tcg_opt_gen_movi(ctx, op, op->args[0], t); + } + return false; +} + static bool fold_shift(OptContext *ctx, TCGOp *op) { return fold_const2(ctx, op); @@ -1714,24 +1738,6 @@ void tcg_optimize(TCGContext *s) } break; - CASE_OP_32_64(extract): - if (arg_is_const(op->args[1])) { - tmp = extract64(arg_info(op->args[1])->val, - op->args[2], op->args[3]); - tcg_opt_gen_movi(&ctx, op, op->args[0], tmp); - continue; - } - break; - - CASE_OP_32_64(sextract): - if (arg_is_const(op->args[1])) { - tmp = sextract64(arg_info(op->args[1])->val, - op->args[2], op->args[3]); - tcg_opt_gen_movi(&ctx, op, op->args[0], tmp); - continue; - } - break; - default: break; @@ -1766,6 +1772,9 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64(eqv): done = fold_eqv(&ctx, op); break; + CASE_OP_32_64(extract): + done = fold_extract(&ctx, op); + break; CASE_OP_32_64(extract2): done = fold_extract2(&ctx, op); break; @@ -1841,6 +1850,9 @@ void tcg_optimize(TCGContext *s) case INDEX_op_setcond2_i32: done = fold_setcond2(&ctx, op); break; + CASE_OP_32_64(sextract): + done = fold_sextract(&ctx, op); + break; CASE_OP_32_64_VEC(sub): done = fold_sub(&ctx, op); break;