From patchwork Tue Dec 24 20:04:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 853216 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp4081360wrq; Tue, 24 Dec 2024 12:06:56 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVgM8wjuux+rdeCf1cAxy31cEwE5zR24jskqQvDnL91ay46ERsxlo0LQ1YIRkMRwJL0eCbG9g==@linaro.org X-Google-Smtp-Source: AGHT+IH+RXWpKZMd3vTdPgiDzz4Aq6ZIgK/j0JE+xmPauvHP+lxxyQo8A+oJfq5aB8aivJ6Ncnvk X-Received: by 2002:a05:620a:191f:b0:7b6:d3e5:4f45 with SMTP id af79cd13be357-7b9ba79b519mr2973063685a.30.1735070816375; Tue, 24 Dec 2024 12:06:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735070816; cv=none; d=google.com; s=arc-20240605; b=NsFq76zS3Fqt8+PrtMaShb9GxM+Kt0sk10ZoyB4NKcpoXxGqYii6A9GBiaySjRjR5c gUCmIpiZ048DAz+mOPhvFJIHJlTHTJ74NhnrKONri/1jMhvunThEt1crzF/wz/DWG6+0 Lk2itd+JYqHJZhsqzXoh6rudg7eUrzTPPTC6zxpuhzYkNpwmBh4FKpsSO5OPwz3W9riL 9OBF9/UZ8iTNgOTXgq032ohTsfUgQ9M9aLi41TuXdCM9tzBPhLQgYvFMAbjGNDdurZ+e zSn3W8jt5kq3qaGiQ3ewc6ej9/gUV7c2fvrR8AbbPjt57T3RNtfDHpzSGlhQnIP7o9tn OQrQ== 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:cc:to :from:dkim-signature; bh=pZ0KIsF1BBfIHqPWVMCdpClBho97FcY+wzgcx7bn3Cs=; fh=vm85eyWrvOAHduw3sqEA+cYBqvHB7M0MHFcRJg7VWOo=; b=OiXFsXFmZsPvK03KnYMjj6hCOlp/LtHcXP2ERJeJ5W7e6so+24FR0vJCTaMpKNZxdh u312nzIIjOFuxWqFS8ZvaeBcONi9j4OF2jJOqkieGEmmRKB0sqGYSMyvnjDzu+aVKAMM zkR72mnvhhaFlQACCGLwInwzBCLifqhmNKDx3zPYilAqIYZT0rPxUh44NKy0SN/aqwnc 6uQFIDyISduCv0yM565u5g/ssAO1eg74Hpabsw3T29SZiXfDaeOAtZTx7pgIdUVqAnCh hPgNhcFZGCtqw6ax3tpoUMbVNkNkLYK6QuI3p9IACv7HwwFaDb8hwmWFC1ADbWwE015O O9PQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=whvym1ej; 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 af79cd13be357-7b9ac2cba48si1356361585a.182.2024.12.24.12.06.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Dec 2024 12:06:56 -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=whvym1ej; 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 1tQBAF-0002yj-MC; Tue, 24 Dec 2024 15:05:59 -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 1tQB9t-0002lV-0t for qemu-devel@nongnu.org; Tue, 24 Dec 2024 15:05:37 -0500 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tQB9r-0002YL-9K for qemu-devel@nongnu.org; Tue, 24 Dec 2024 15:05:36 -0500 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-21675fd60feso73525435ad.2 for ; Tue, 24 Dec 2024 12:05:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735070734; x=1735675534; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pZ0KIsF1BBfIHqPWVMCdpClBho97FcY+wzgcx7bn3Cs=; b=whvym1ejpDLxcBCimTNssEFz4EZQR1b1FBqicwIehHEDNOM78yqxhJFoqfUmPMMrNR ZJ5TEceHYkCxy2bB2MwgEV2zJAwLo6rNp+VMIqFis77Nh78720ASQHcDaSTifaR8BhZy diz0NOvvnEXB3wu6J6unSUVs0r6jO5XiAq987T+OOJhNK6ULjov1Bo4PrjGOxS5zYqE/ 2psBWewT6eztV03FaDP41w3eHAq/iq2h1L7/+UeL9cetcRhNxVpyjHqGHFOzywGmZi/M dJIn5vb9txUT0e5x36w+aO/KOJfH25uFxT51Z7sc5nzzJ1T08sMWApY1IX2L7jL+D/Dj NYOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735070734; x=1735675534; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pZ0KIsF1BBfIHqPWVMCdpClBho97FcY+wzgcx7bn3Cs=; b=Oikatbx7Eob7MXCiUGIHuvkdBsVOJP+Ccsp9FZ6pT4un+xfTyhdryMh/jj187bZLRD FOl5KBuNxl+WLd/9leGqQHYOn7R485higaDDgUFi+7yrSPY962b7UpBvwiFtvAeKJSRF IKk4WDXOJyhxm1NH1VflRyND0iekUjyaFQ1lyRAUycXDUxEiZ2XJXe+apddddNwhGZjD /yU217GjdZYJtWVzcc0oFpGvpaLfzVmPADY1M9Vu30gJqhwoZRmeuFiBoRvNDgsQCvrI rbFWuFH769fTUfSYrKOZ0otGomvHJbbXYl2DLbTvqNx498RP1SK5smbt2qAKKrdxHttf QMPA== X-Gm-Message-State: AOJu0Yy+xMjmbpIxHys91hKP2ZWpPNWS2Zvq/2ok2gwZVwPA8il/UlD9 wPb7A1eo/6HubgcEC7vPLEyjqo2qEW/sqCPyY8/AqUaNdx4B9gHrnFPWf/p8xDtFiqFIE2Qr9C4 Bl4Y= X-Gm-Gg: ASbGncsN8AdKACo5QuqXsP/sLjKo8HG421Fx3pKz06x+wqo39MSVzXkB1sGi6YKY2zi 0ovisD3nSFMajEPZv28dufmn3ws3roPEKOfsxiNkXvckAx4pZhbQlnG22Xt75yB1UiE/60Wj9Pw kyUVyQF3K21/57kl47FWnuIX5fj7WfuCj695FrL7OaDFCUomqtjmvwnm5Q18b517T3FOcTlZxji 3frNe5JPqVWtX/29ahXDVyoWUrR0GUzd1JdxPb/8wvyFhX0NQ33jXD2Vr3vP9ouh8m37Geqayg7 nthc8Y8yoEjh9/F05Mv23tZhfg== X-Received: by 2002:a05:6a21:1014:b0:1e3:e836:8aea with SMTP id adf61e73a8af0-1e5e046f453mr32506448637.14.1735070733786; Tue, 24 Dec 2024 12:05:33 -0800 (PST) Received: from stoup.. (syn-156-019-246-023.biz.spectrum.com. [156.19.246.23]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8fb895sm10027159b3a.162.2024.12.24.12.05.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Dec 2024 12:05:33 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 12/72] tcg/optimize: Use fold_masks_zs in fold_andc Date: Tue, 24 Dec 2024 12:04:21 -0800 Message-ID: <20241224200521.310066-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241224200521.310066-1-richard.henderson@linaro.org> References: <20241224200521.310066-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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 Avoid the use of the OptContext slots. Find TempOptInfo once. Avoid double inversion of the value of second const operand. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 4a5b52916a..2096d705bd 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1330,7 +1330,8 @@ static bool fold_and(OptContext *ctx, TCGOp *op) static bool fold_andc(OptContext *ctx, TCGOp *op) { - uint64_t z1; + uint64_t z_mask, s_mask; + TempOptInfo *t1, *t2; if (fold_const2(ctx, op) || fold_xx_to_i(ctx, op, 0) || @@ -1339,24 +1340,24 @@ static bool fold_andc(OptContext *ctx, TCGOp *op) return true; } - z1 = arg_info(op->args[1])->z_mask; + t1 = arg_info(op->args[1]); + t2 = arg_info(op->args[2]); + z_mask = t1->z_mask; /* * Known-zeros does not imply known-ones. Therefore unless * arg2 is constant, we can't infer anything from it. */ - if (arg_is_const(op->args[2])) { - uint64_t z2 = ~arg_info(op->args[2])->z_mask; - if (fold_affected_mask(ctx, op, z1 & ~z2)) { + if (ti_is_const(t2)) { + uint64_t v2 = ti_const_val(t2); + if (fold_affected_mask(ctx, op, z_mask & v2)) { return true; } - z1 &= z2; + z_mask &= ~v2; } - ctx->z_mask = z1; - ctx->s_mask = arg_info(op->args[1])->s_mask - & arg_info(op->args[2])->s_mask; - return fold_masks(ctx, op); + s_mask = t1->s_mask & t2->s_mask; + return fold_masks_zs(ctx, op, z_mask, s_mask); } static bool fold_brcond(OptContext *ctx, TCGOp *op)