From patchwork Tue Dec 24 20:04:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 853211 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp4081179wrq; Tue, 24 Dec 2024 12:06:26 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUvdYxoyMamN1k2D3zj6pQ60NMQcGVO8y27IJ5QI4rzzrRSjRvP6pLYaQ9PVo8SVpTbRK8lLw==@linaro.org X-Google-Smtp-Source: AGHT+IEOX4CoNXEwQg802cAIDeEfoHyLxhXw0kDIleqc4LLR2VRiGQqNKzzbJo5oDsE2TgpPhc8v X-Received: by 2002:a05:6214:20aa:b0:6da:dbf0:9640 with SMTP id 6a1803df08f44-6dd2332ed7cmr283890306d6.7.1735070786601; Tue, 24 Dec 2024 12:06:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735070786; cv=none; d=google.com; s=arc-20240605; b=H4Y9/5zoA/yw/CX0igMreZf4zBqcyb6BSv7tw/Ify2I1HFAZPtrZGuRfcZRaO52/Ht 99/3wi/1PSgzqHKfCGLVaDd/86umcnmJRpNbmtAnyXVb6gD29IPkDK2NuHVzFLK2a9BO zr7niyJO2z3ROkWW6s62flR/fdX5vXkWtDfK/Pb4qbdk8qaq2dbSwT0VysF20oZEb7tL gfmDcm08BH7Y/IsAepbeW1X3LxMx37C6CqUiq3CbkGQKHX0Yscj4ZTjKd+o35SyoIpfX ktxE0dvf2nuRXFyqhL0F9Qzb0JC25mQvYBfhrnPPapH63XO+SP9VXhQfpFZveWRio6mS XrdA== 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=MFhNaTorOWcHDFv/B5ASCBB74fNXcu/plUbi038NaCk=; fh=vm85eyWrvOAHduw3sqEA+cYBqvHB7M0MHFcRJg7VWOo=; b=B4RV1mhHGSBSfHLpe8GRNtF81fTjT29PCOo6yhx7Sj3xo1PGO7so3latffwe0jTJIC yMA+9VLUOzZhuvwuY4yRrhTifFX7NKFyAtOTR6XJBHQkfJ+r3wo3w1twmwDHJGV5hYPD uGpvacWJupxjPrKdKRdIJ86X1jpkG46sTl0Sy8dc3a5lHqAE6dj1MXCjzN4DpOD5zB8Q Bn8wqCQIUX3j/LMPmsY0KM7Vybcb8w46U7OktbL66VnRjD+YCH0x6pT6fs3i0skzt8RD QMFrlDlakBpOKFZw0ezpDHwpVSRWS0S7Uw5QC8+sydRTOdB+erLiNnqzRJ5RYmwY3uZQ Cb7Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j4tSOPVV; 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-6dd1835fcb1si137818636d6.476.2024.12.24.12.06.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Dec 2024 12:06:26 -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=j4tSOPVV; 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 1tQBAI-00033L-Gi; Tue, 24 Dec 2024 15:06:02 -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 1tQBA5-0002pt-If for qemu-devel@nongnu.org; Tue, 24 Dec 2024 15:05:51 -0500 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tQBA3-0002aY-C7 for qemu-devel@nongnu.org; Tue, 24 Dec 2024 15:05:49 -0500 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-21670dce0a7so73888595ad.1 for ; Tue, 24 Dec 2024 12:05:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735070746; x=1735675546; 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=MFhNaTorOWcHDFv/B5ASCBB74fNXcu/plUbi038NaCk=; b=j4tSOPVV+oTkrDAZ2wkTvij8JL3aoam2F0OcLOEEVmlUN5rGTHci0u/5rm2usrLfbc BqOJ/jJoULvNYcA/tGZuTuoFun+tME1L+JcYCgIC1rAUoQ4DubhQa5+yRhDQ8GMUjsnF yu3cnSjPKoMWXS78uLK6JHgtB+MNL9ow4Vf3FXDE6QZPDiFySpiuGc3egYfxYeQZiFSz q89ws4nAGmV/FpGH17P6tlkaOrnVF9x0OrLM30MJvpQhusPDvrIznAcABpLWLz75UObE OAKkk0jP2weDXRbGs6j+MxD0vVoLXe8TTlToRvuCytquSrNLk98CfpiqJaS2jrMLnAjT O78g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735070746; x=1735675546; 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=MFhNaTorOWcHDFv/B5ASCBB74fNXcu/plUbi038NaCk=; b=wMuOcVtZ0a/QxvN3DxBTeEAJqlDKCMUwV6gelFaYSYU72HqVxt4WJL5n+AxhOXK1Ik R5p79MEVA64TDnVf5vccAZ6KjAi1vvo67LXkehkpmJYX5EhUvqrDIt7HMOONBbIkrUVh Xp4oSbDPJ4JFN6i42PCA8OFjYl4NMVxNrqJmtQrDU7jNUAJQc9uu13QXYLxwYsu9HZVp tdl6/KAnj65rZbVDrJIS/WKn8m+XnPfgTzzV7XlqW1XdABQTqcxZbU/r3TuhKpnkiA9E ZAX1Qztzb2MqU0HGc5ni0AGmJ7ZVOXXRG16VtIYe/0mB9azz3jry/bPd4k/kXs2CNEaO ibow== X-Gm-Message-State: AOJu0Yx8IfHxBU1fnmiGsKgCVB1zvVgKwq2eG+AYEHYGNnIUEPlpvK7y 8y35wcqtj9C2Pj6rGG/Y7l9bA2g/UsPl0Oq2pMM17Rd7dz4GTO7DAA+i3lG9/4te/ub/BDsbHcI kocA= X-Gm-Gg: ASbGncvyemmWPZyy9dQvICRsNyB66TzU/pkAf4LAdlGVvOlyGuyeWbbXas3K67rlerJ 9GrHqcIPIxKyPjZbccpInXbdqEZHzQbEU1UYQj5hzUoHeCBAgNoq1ITgUsnjYEIWtTInJn9dHFC ApGaKcQWt53zYsJ9MtCYdvKMe6jcGDp427zLx6aPErd+WeZfYJQzj21PO4Yb5eodK8b8OPGiQgu 7tn7TY2zrocv04kqgSstMcHkmEaP2qQPbU2hvfx5EbDdg+lStHzrQUFBd8Od/hZkjayKQjSA1is AI+92aD9yRN3JeSM8JvZ+OC/ZA== X-Received: by 2002:a05:6a21:9017:b0:1e1:a434:2964 with SMTP id adf61e73a8af0-1e5e0459369mr26829413637.2.1735070746221; Tue, 24 Dec 2024 12:05:46 -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.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Dec 2024 12:05:45 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 25/72] tcg/optimize: Use fold_masks_zs in fold_movcond Date: Tue, 24 Dec 2024 12:04:34 -0800 Message-ID: <20241224200521.310066-26-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::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index f62e7adfe1..0104582b3a 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1889,6 +1889,8 @@ static bool fold_mov(OptContext *ctx, TCGOp *op) static bool fold_movcond(OptContext *ctx, TCGOp *op) { + uint64_t z_mask, s_mask; + TempOptInfo *tt, *ft; int i; /* If true and false values are the same, eliminate the cmp. */ @@ -1910,14 +1912,14 @@ static bool fold_movcond(OptContext *ctx, TCGOp *op) return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[4 - i]); } - ctx->z_mask = arg_info(op->args[3])->z_mask - | arg_info(op->args[4])->z_mask; - ctx->s_mask = arg_info(op->args[3])->s_mask - & arg_info(op->args[4])->s_mask; + tt = arg_info(op->args[3]); + ft = arg_info(op->args[4]); + z_mask = tt->z_mask | ft->z_mask; + s_mask = tt->s_mask & ft->s_mask; - if (arg_is_const(op->args[3]) && arg_is_const(op->args[4])) { - uint64_t tv = arg_info(op->args[3])->val; - uint64_t fv = arg_info(op->args[4])->val; + if (ti_is_const(tt) && ti_is_const(ft)) { + uint64_t tv = ti_const_val(tt); + uint64_t fv = ti_const_val(ft); TCGOpcode opc, negopc = 0; TCGCond cond = op->args[5]; @@ -1956,7 +1958,8 @@ static bool fold_movcond(OptContext *ctx, TCGOp *op) } } } - return false; + + return fold_masks_zs(ctx, op, z_mask, s_mask); } static bool fold_mul(OptContext *ctx, TCGOp *op)