From patchwork Fri Oct 29 04:32:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516411 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp410423iml; Thu, 28 Oct 2021 22:06:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyc4bznaFy3PTAhnbl1vUPYb3ybfvLSjTRkpyzrHuuqj5x9Y5eKIehFBtAKjAFiSCPVPX5g X-Received: by 2002:a05:6808:d47:: with SMTP id w7mr6532316oik.16.1635484000211; Thu, 28 Oct 2021 22:06:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635484000; cv=none; d=google.com; s=arc-20160816; b=NlRZCLXEltMORQz/JhAqZy0JucB6xlxzOAS0zRJvNfgfB8Qeu0xr+pFgASmuCYbSgZ 2E6FuhIoAEAdRM5t9FjGAiPygAi2lGY0vXB5+KVbysSQ9RZZCpNWGO9PmXQDoB1nDfvx J/MQ9VzIuF/M+5mjorp25Rz3OxHuzYWWo6d26GNwMxmbXEQoEiwpJPtZhPXV5qAY5AlI oxijS+9M2duZ1SgPaGsSn8wdayLcxyY25TFcsVChFfF1EltK7EUzLQKa+BPBjAEQce+k ALcdPMrp6TxzA+1If6L/vabNV9X/13v/ZsoHWmEHHoAKJvWmePXrxlWWVns2v/+4VnyN DEqQ== 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=F1AVpbG5TP2qMj+ELcN61uRCpwzeIi0grwtPZKRIVFo=; b=pzxsDmcWxePLRf+G/dr+3vsvLnygKhbbAHN0tp31bGMo1mTaE7173VdL0omsFS8uvj nem3UFhUBPbwPAnNKzVjcK7xndn0t8+4zt8RHcznjJ2Ag/igqxNeyD81GCkQisBsPW/v p+4YXkCmh4w1F2ii8K7yDlfSCluZTtgicBFHzoFbLHoFlV/RePjF0Ym5bAcvTs5uQlO9 ED8XvDpssgZM/WICZJGNAGBLiAebV+eFodDF2SCtg/SzRTeVX6D7szO5ZtoqdwCK3Azj 3p5qqp8C0kwTvxlKYSwiapvFqqX2TZy16ws4Z5CXoXPzXYnlkt7kfEF6AUHI5LP34P+8 OKiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H6b1J7RZ; 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 bl10si5749335oib.202.2021.10.28.22.06.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Oct 2021 22:06:40 -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=H6b1J7RZ; 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]:56102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mgK6B-0001LG-IV for patch@linaro.org; Fri, 29 Oct 2021 01:06:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51522) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgJam-000560-At for qemu-devel@nongnu.org; Fri, 29 Oct 2021 00:34:12 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:45802) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mgJaW-0007z1-OT for qemu-devel@nongnu.org; Fri, 29 Oct 2021 00:34:12 -0400 Received: by mail-pg1-x52a.google.com with SMTP id f5so8659864pgc.12 for ; Thu, 28 Oct 2021 21:33:56 -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=F1AVpbG5TP2qMj+ELcN61uRCpwzeIi0grwtPZKRIVFo=; b=H6b1J7RZsVJ+zUkIfH34uxFF62srtgQ8ituwjRThfa5qpqw1gLIMPfz1qxEqL+fYnL Ro3HYRrfgELKgraLVL7wvY0Ee7wAxb7mMq8b9D0xlAki2hbBxrapMP/aIqVYEIK4m87/ 8svEAyCh/shlwJufxvVfFX5nOnY/sbtKo6H2C9AcErKF+gPSVai7oV6AN0SC0Bw5RLCW RWsvtv1b5Ng/xA8ejXuUF4V4yj09CMzDVImm6DbvPsm+Mc4LgaGhb4+ADTVukYip5NEL /gzGJCw6uy2n1FpnzLwoztMf8ubQZCdnLn4ypSMPDLclyYczY4BWxy0F+ltrAw4G86zB zEHw== 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=F1AVpbG5TP2qMj+ELcN61uRCpwzeIi0grwtPZKRIVFo=; b=oT155XdeZ7QQ76u7v9g9/63t8xxhEjyVwOc6xBmd7TwwtJAsR4wB7wSdPtQtouWcGn wHp0bOc221pY7ZWNs2c8Bsz1zS95iXcdAMSHWPgDmSCPtjwiBeiiXfB0KpIO+Y+l1CAC XoY6BMcBOgdxCu+JwMoEr1lXuUEHnmuxKkxflS1iu0HWCPaVfoJ1kuRNBSYYzdNFTuTQ JpbQo9oFod97rt6lJHqldeSMiy5s5TFnthlhAkl+OxFkaZ5JbsuUjOyhpg5bgGZZAEUO PBHk+fG0Kjx7x6+3x/4paNhIwn7Yz8VXHg6BcoEiIY461garPBQS0xzjp7BPW5fZp9yV CoNQ== X-Gm-Message-State: AOAM530gDXqc1mkXoXkqYPq6PEReosvux/a0RTvJhQJXpiOXAfRTVlN7 hFxDkKMbS/gkmHoQfFUbynAyeEPVTfKc2w== X-Received: by 2002:aa7:83cc:0:b0:455:c394:caba with SMTP id j12-20020aa783cc000000b00455c394cabamr8787818pfn.28.1635482035262; Thu, 28 Oct 2021 21:33:55 -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.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 21:33:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v2 29/60] tcg/optimize: Split out fold_extract, fold_sextract Date: Thu, 28 Oct 2021 21:32:58 -0700 Message-Id: <20211029043329.1518029-30-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 Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52a.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, 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 , =?utf-8?q?Philippe_Mathieu-Da?= =?utf-8?q?ud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Luis Pires Reviewed-by: Philippe Mathieu-Daudé 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 faedbdbfb8..3bd5f043c8 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -888,6 +888,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])) { @@ -1126,6 +1138,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); @@ -1727,24 +1751,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; @@ -1779,6 +1785,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; @@ -1856,6 +1865,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;