From patchwork Tue Dec 10 15:23:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848752 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp384426wrn; Tue, 10 Dec 2024 07:26:25 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUBLdPkSYZhzFvr5p1SvxdKm8kke3vPejlP3L2sjl8waqPQGE+sDrxL7teOQEF0/aSzsERfJQ==@linaro.org X-Google-Smtp-Source: AGHT+IGcytKdvCDSiaAGXOeVOWc2QO7/MyobYNN2xxxbmKO+/jJ/kkQrUZ25DbjdC/1wz14JUeCT X-Received: by 2002:a05:6214:1d0c:b0:6d8:9e16:d07e with SMTP id 6a1803df08f44-6d8e70f00e8mr272279806d6.4.1733844385599; Tue, 10 Dec 2024 07:26:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733844385; cv=none; d=google.com; s=arc-20240605; b=K+0wXleUQ2cUJxf7Nb5HOG8nwuKWMIS1Z3NOtGZUzpxoHn3m2a8N5EPE2wlQ9DAg1j 65Sbh3XvkpOwE3t9v/k01AwTm9YmCgt5CGsr3ie26E0TzvstDflJRT++9903E2ml7+1v rCXQdDcjzNzmtZrAl/9fXSePdO21xJx7uQnbUrf0WWmDD+YsE13wEmrHVUrvAbfB7Xot KVoxT9UPVhI5JUWMIcjCS3ah3Wvy5MdwoqJLYBHPsVsdFc6RjDmvsMiAZcvz649voUHo vMAvsxYNTMvzuc2kKU2uGUrih20qNKqPdcCpmd8Onim8osltSAM1S0WZ8hWA8UnRJytl AqqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=DObOGllSB70fmbIhwRk8zrVb8ETW7KIGs2THZc+KVkM=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=lh4sr5Cu5pERTNa5GltF3BrDWkVkO/SCJ3xtz/b5AkKnJkF/8IMiEH0/HzrHOgfz/2 xYK29IOssUY6cSsWe5x+pInnBC8Ms+zr4mMQ36tpuKuRjYsQx1HgGAlcAwqvkeUYlRCb 2/GQ44rhUCmqKlYxQ5poAdMACuhqJ1Q+sz0YEiq3sVvzuBpnLYmolltYghh7yIpy1r0V hTnuXc3tMEMKT5LMWJY6zkFL9QCrE4a4y9sv7Lfcqr2caHHqgoOY3ZYp8MnX7AZQ25c/ 5I8Z/Aj2dnevazk3W5jzxstw8pgLGcU8/0XNzjsYcn6pQD5c1kP7ZaCd0imCJ8J9jnFf EllA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yxvdqPGF; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d900506089si90408776d6.132.2024.12.10.07.26.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 07:26:25 -0800 (PST) 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=yxvdqPGF; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL27n-0006BI-1P; Tue, 10 Dec 2024 10:26:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tL26b-0004l6-G6 for qemu-devel@nongnu.org; Tue, 10 Dec 2024 10:24:58 -0500 Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL26Z-0008QH-RF for qemu-devel@nongnu.org; Tue, 10 Dec 2024 10:24:57 -0500 Received: by mail-oi1-x235.google.com with SMTP id 5614622812f47-3eb7934a948so173810b6e.2 for ; Tue, 10 Dec 2024 07:24:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733844294; x=1734449094; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=DObOGllSB70fmbIhwRk8zrVb8ETW7KIGs2THZc+KVkM=; b=yxvdqPGFZ5HcF49IKrZO/kIPFb3YWBYceyQxn5jpmu6hjI1aonzSxHrCZ21qdITJYK r1JksP9l01hrOQ5HoA25HexkoHGqPU05+nKh3LEt/qirZIOGER5B5P6HbhYytDmzjBXO UYcNhSgQWj8eDo5CVu8BwsPiwBXeGL2tdr6jsr79v467h6Dr9x/U6kd6RDy9f2tG1aZG I/daeaxYwDKokXruTS2ului9R7aBTxjxp8rsGhpwUj6FJOq+1zcf9vCZAmtQr1W3c1H0 NgtDJ0OE0tnQUZzCY++9kwo6bHCKX65xPRF2UZVcQp8IYyfgJ93H6nvci29a1nfb4dDG Tfsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733844294; x=1734449094; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DObOGllSB70fmbIhwRk8zrVb8ETW7KIGs2THZc+KVkM=; b=AbyjIRBlisTY3mItto5MFFRkKYeRFgOWpw9s3aLgBzfQ4KrgEs2q/karDz5FWCPnmI xsKyKJVIXxNwo2xS81aeFPTuURzBkEKzU1/rss5EqASVsAcICDOFcfvKHaatz3mDFUdI hmoXMl764yDz8pplh/pP6qdBvSGCwIBzV5mxLjU9tS8ToAAkgBVEgKlKxKq+yHDwjR1B 43B+Bs1u7nI/fhq3Tm2ConIv6l6bCo1QRRcmj5OHiy0pJrCTsWm1AsEJHaudZBpF2qG8 w2kGA8IpyLgtqG1zfGMSLrDZNNH65PujvhIbjiWMpmAMm/h+BoyibRU9UAQ4Yehu4CM1 vkMw== X-Gm-Message-State: AOJu0YzyclLrSEkNtTrVPBsIGq49FO6ykt9ZqDkNj35feNeRhfXPHEwS YRGTnpPCqF9o87/snxFa3kpW8MofxzCBHwzQnS4D/JWW4kKaTaGSQ/NeBbNi/Yu+9RKxQtY4jV+ Q4IESSM6z X-Gm-Gg: ASbGncs39iF9oURNpiXGETmz5SiAv15QboAK5gouQ47VdrzyElgznSiAL++cZ0mbHVL X/b7t8dAPeFACkZiBZQeuFr70d0rcNmlUqYZrHDxqqN2gca7Ixgcevpe5GMRp3CTWHFy66zl6zh 4wEJS44UL+NWrnJylYChtRVj4qaxpcgHfUaWGqOzP/KHE6qteGSQb+OWsAyFHr92llGYDx8rv9y hL4CksXcB1i6rjYNlbcJqQksQ9VfDSTHnUWc+0ORxmhQEN/6fRWYWKa8NsY+Q== X-Received: by 2002:a05:6808:1805:b0:3eb:5e08:f806 with SMTP id 5614622812f47-3eb5e097668mr4544792b6e.29.1733844294527; Tue, 10 Dec 2024 07:24:54 -0800 (PST) Received: from stoup.. ([187.217.227.247]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3eb076b9168sm2776435b6e.14.2024.12.10.07.24.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 07:24:54 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 37/46] tcg/optimize: Use fold_masks_zs in fold_shift Date: Tue, 10 Dec 2024 09:23:52 -0600 Message-ID: <20241210152401.1823648-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210152401.1823648-1-richard.henderson@linaro.org> References: <20241210152401.1823648-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::235; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x235.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.29 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-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- tcg/optimize.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 551f96dfaa..bec5a07288 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2530,12 +2530,12 @@ static bool fold_shift(OptContext *ctx, TCGOp *op) if (arg_is_const(op->args[2])) { int sh = arg_info(op->args[2])->val; - ctx->z_mask = do_constant_folding(op->opc, ctx->type, z_mask, sh); + z_mask = do_constant_folding(op->opc, ctx->type, z_mask, sh); s_mask = do_constant_folding(op->opc, ctx->type, s_mask, sh); - ctx->s_mask = smask_from_smask(s_mask); + s_mask = smask_from_smask(s_mask); - return fold_masks(ctx, op); + return fold_masks_zs(ctx, op, z_mask, s_mask); } switch (op->opc) { @@ -2544,23 +2544,22 @@ static bool fold_shift(OptContext *ctx, TCGOp *op) * Arithmetic right shift will not reduce the number of * input sign repetitions. */ - ctx->s_mask = s_mask; - break; + return fold_masks_zs(ctx, op, -1, s_mask); CASE_OP_32_64(shr): /* * If the sign bit is known zero, then logical right shift - * will not reduced the number of input sign repetitions. + * will not reduce the number of input sign repetitions. */ sign = (s_mask & -s_mask) >> 1; if (sign && !(z_mask & sign)) { - ctx->s_mask = s_mask; + return fold_masks_zs(ctx, op, -1, s_mask); } break; default: break; } - return false; + return finish_folding(ctx, op); } static bool fold_sub_to_neg(OptContext *ctx, TCGOp *op)