From patchwork Thu Oct 21 21:05:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516098 Delivered-To: patch@linaro.org Received: by 2002:ac0:bf50:0:0:0:0:0 with SMTP id o16csp345427imj; Thu, 21 Oct 2021 14:31:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAwBzXtxPbYFe7ZsG7iJ44S/wMpGyOJzlfRYLKMt9aqPJUrRveCikWVwDedYPCJ0kubl7N X-Received: by 2002:aca:4185:: with SMTP id o127mr6706569oia.129.1634851919285; Thu, 21 Oct 2021 14:31:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634851919; cv=none; d=google.com; s=arc-20160816; b=i+5v6a8VsO4RE1cqG+WKHJIal45NmmSfj5Jmp7zR9NYg8jj5tmB+SNsPN6+33PngUu K6LXhRa2oB5d5krHNnEY3lCn/H9eU8YokHILrQHiIyC424hxx6cK8J3DKzQuIzaV2TOa SSxFp9z//5v65ZsiNHjhULv9RydXdbSZ700efzi1cqfVU4DwL/Zn0JAovGZlmfMkptDT SMRBX5nESkZFXGWWYR4Sn8Xpp7OfJt9/BODuPV3GeFhx8h5uIxfqZyVvoGxHys+arIpB FG5jm5lS+6R0cJuF2npFQCWIDerAKpwkD+6g8fhq9B11ZZBB1mjyNlvEk/p5vhJDUSnr o+7w== 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=vJZ8Z/RTabJlgDj1P6FGu7e2eabHE2BgKAEMKC4fW38=; b=L7MXQM/g0jztDPXdcQc+wqCJf2534zFvWe1VV5frPmOYPwAFWi7pIFzw1YGzCodTQo bxAGOlruGOoaMdettntwIHH7KY/7OD9PmvH/bfk77nTaD9CzihywqaoTcu+oHVD9FbEg 9OgNwfpItHmX02jK8RUddQKgvfFQJ4yutVlXZgQtp2kkk5Db6ksCazS/11FYMi2rydMF DcD802Mu51zLzKmzk8nET77CRcsfqPh3x6I81g4QLPKSF9wTGt/z8vVDIAkROSzneSPE 9/Kxulvd3Mzl61lICvVTQt7OkTGBk0PzSn7vs9V0tkK1/kKCBZoHGfItTtrQSxpuTtMd MUeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xm6dLo0X; 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=fail (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 bf32si9970435oib.237.2021.10.21.14.31.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Oct 2021 14:31: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=fail header.i=@linaro.org header.s=google header.b=xm6dLo0X; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdffK-0000Zm-Hq for patch@linaro.org; Thu, 21 Oct 2021 17:31:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdfGL-0007fT-Ea for qemu-devel@nongnu.org; Thu, 21 Oct 2021 17:06:09 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:42565) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdfGB-0004Mh-Dp for qemu-devel@nongnu.org; Thu, 21 Oct 2021 17:06:07 -0400 Received: by mail-pl1-x631.google.com with SMTP id w17so1275012plg.9 for ; Thu, 21 Oct 2021 14:05:59 -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=vJZ8Z/RTabJlgDj1P6FGu7e2eabHE2BgKAEMKC4fW38=; b=xm6dLo0X7Z9vdABnMofSK2VifuyjXaaKPsZ0inD0/RdznYACJuSVEiqTi+m9H3TWGp re0Mc6+XOMG8dXuxlSPIxWlmRg7BybUmocXqZHttO+dfz5y1DYChM3lybbTiHLVF59dg QeJLSBFlAEb1xIMKA22lvmcAxoSmi+kq3YDa0epyv7Xzp83CleX3H2nl6/oOgcqsqgok j2sXxXAFd/NBTgPat7tBxDcKxVp9OdmsGQX8gYXYvFEwrCsN8yJwYOIsaafIMYgy2JZ6 u79eBYCF22PduGtnRoi8oo3ZbIoBEwR7J7NswrQrT73IeDOk+ysvHo1I5baGy/9ehdn+ MxtQ== 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=vJZ8Z/RTabJlgDj1P6FGu7e2eabHE2BgKAEMKC4fW38=; b=NDwOUlAsJYzSfSbBBSGRj8VFtvSUpixgePNiYMM5LiGkMkbyu8QX+j5JrHjjgVT2TD wMGlc7qp9PsJRAjLQh1O84xOiqp7U90HUZn1ecenJFRwvS2hIgdIxbGPvAYcPM1zvtAG beeOmZiJAkNTCxyS0CycCU01OkhNN0T4v9uzNHIQuLQ5+xPu7GOOdK9DAyGdjxfIVlhE MkaG27EHtkfnfE0X1HUDan5yEYy2nh14QQlnOF1O5flR74DpI9DlGwphGLNA6rDQfrrr GpFkEhJUh9aSu/wmy/eRkeWnudgm6QT1INCJuu22IOzycm5Rab1QvEq8nD2VOjQ9PY5F 01UA== X-Gm-Message-State: AOAM5310f4YeMmlHbOANWW0tqyA93snQEa8FyNXXOdanhEp2pvzpECOw 3ZrR6Wp98zIp2aDPNCr9lWJwW3ntwwZX4Q== X-Received: by 2002:a17:90b:1910:: with SMTP id mp16mr9373303pjb.30.1634850358160; Thu, 21 Oct 2021 14:05:58 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id g7sm5981670pgp.17.2021.10.21.14.05.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 14:05:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 24/48] tcg/optimize: Split out fold_extract, fold_sextract Date: Thu, 21 Oct 2021 14:05:15 -0700 Message-Id: <20211021210539.825582-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211021210539.825582-1-richard.henderson@linaro.org> References: <20211021210539.825582-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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, T_SPF_TEMPERROR=0.01 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@eldorado.org.br, alex.bennee@linaro.org 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 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Luis Pires diff --git a/tcg/optimize.c b/tcg/optimize.c index 885380bb22..3fffc5b200 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -883,6 +883,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])) { @@ -1111,6 +1123,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); @@ -1712,24 +1736,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; @@ -1764,6 +1770,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; @@ -1839,6 +1848,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;