From patchwork Tue Dec 24 20:04:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 853214 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp4081299wrq; Tue, 24 Dec 2024 12:06:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXj5TsyE73lA5OatT4yMU+2p0hE8m3XUW/smdjVFRAqS19pGx3dBwO1DxWtQWRE93IB42v2Wg==@linaro.org X-Google-Smtp-Source: AGHT+IGYYglk5MGYo/6lEXV6LmDmwncy9/ouwroVNYjsqsZTE/3J01NzR/ZHNvWQmxz5RbpyA5Xc X-Received: by 2002:a05:620a:2995:b0:7b6:dd89:d86f with SMTP id af79cd13be357-7b9bacd3c66mr2956826585a.24.1735070803570; Tue, 24 Dec 2024 12:06:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735070803; cv=none; d=google.com; s=arc-20240605; b=eghpOBglg2CbAJD2R9SX9VCv107vFTmAmvW41FXP648GywAyuHnmp+ju2jSAll8YMg 7+37aYuJZuHPJWM/broq+4MKG7MLZCZ8BQar1BptidrWd4otu2SEdxqsnHYhQ1fOc5h5 x8ZMtVPvpAsECkk+FFMkStjs8EUfmVaAdXWEyn9jnqjTL04lhrJtLM6n2MS2d8tk3JOh +rVeiygJ7ps75QK3CoxnKrBldS7LHurBg95rIbU5WXTjkXOAWwzrdCUgUVLVaZ5Utpmt Yh2pE8i7uMfCroQqvHHWG8Nc/SnQfi7Ieyc5MZMaz/mdXxEx8S3MOOTcQ6s6eqidGzIf yP7A== 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=kwAmrbK+z6InFUYOYJQouqu9jlEe2zkE3MrW95sabRA=; fh=vm85eyWrvOAHduw3sqEA+cYBqvHB7M0MHFcRJg7VWOo=; b=dc9fUPb65t/nM8w4UnPyyku3uF1NF+rv3TQ3owUp5QO/VhSJ8G6V9JTvsGOYiYLAgm CGPfkqzJIxgfN9jIjNDgfKpG47JTWRtd1h3YETKPdQ/6VyXjV5mWU8iM9DYRjrEETQdf r9ChHvN0Zpm8pxVwpdv6GuI997E2eMUjBNjyOFzXsmsvQxFPY++elBJxGJ9LPa/kuk4O ePk/41EKRp3TvhOYcKRD5+cFLbjkE7DZpn4X60yzUTuUwaSRjY89z+uWaThzXF++gs78 xsJVw/vnk5b8R8nOYI8VumVXl0ooRd555ozATA6d+HAoSY2msSnbqj3KFOiJjDsOKL7L ONsA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hptUS2Qc; 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-7b9ac4ce7edsi1413885085a.386.2024.12.24.12.06.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Dec 2024 12:06:43 -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=hptUS2Qc; 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 1tQB9w-0002mj-T3; Tue, 24 Dec 2024 15:05:40 -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 1tQB9l-0002jY-Ey for qemu-devel@nongnu.org; Tue, 24 Dec 2024 15:05:30 -0500 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tQB9k-0002X3-1p for qemu-devel@nongnu.org; Tue, 24 Dec 2024 15:05:29 -0500 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-2162c0f6a39so64868855ad.0 for ; Tue, 24 Dec 2024 12:05:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735070727; x=1735675527; 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=kwAmrbK+z6InFUYOYJQouqu9jlEe2zkE3MrW95sabRA=; b=hptUS2Qc/0PzPXBWt5iKl0AuHcyGIEIHu5iwdrsBDtFbZ+QdI17AJc2Ng3BTTZicLG sPW1v6qbPRtWPW0NkBdxU4h5P/cPA/49xDZoX52xYxz3Qi+Yg8ve0ejz+0Hx+etUTTBP WCkdlLbUN2mQuSJJzmNrhk4xT59qAa5uPxxrfhh5SVezQn6nifCfZ1WSKBTfiBcAU+5O whxC0wZi1LTGUKqKMeB08UDUJsREP0wKTIsLlqRCZPnOAVtz5O0uCenS8KgnDudSdsGy DT3ykdXyOU/7gW4ErlWh/lzMRrVMn+ZfenMYMjpYDyUDrSqDTM+p1P/rI91HqvU9JVpS QReg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735070727; x=1735675527; 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=kwAmrbK+z6InFUYOYJQouqu9jlEe2zkE3MrW95sabRA=; b=qpMVj8oiDI/OoWStCDjlpQB6kLsItzQ5cAN6/RqXuHYwIn5Rm5sh3sZybamuCeK+AF 0qoLJ7hqUU2uFRUkEwgl9CSy2f1esccHg4aAv8ZumKHZPJq7cclWCssuYhmslWyO56Xx eesOaAxb7TK+PODsiDhfvK4p+NukTY3IFfdMC3EMF44AtPm8vDgN091HI4lBf4tbo4V5 eYO0lc+oQRtmAB2xh6/d2Ef2TNuTbrXi4TfcyXn1eg+9VfP3e/KtDM+lObuIN8bam/vs xNaaNPmmnWlq/VHVtEyeHPELKpjuXx6hVC4BW/eQxN2/gshBwC0dCNBZ2G5nr+b7w59R CNNg== X-Gm-Message-State: AOJu0YyAAbQHa0AjoZEXLFejItzTjkNGYtCV/pnx8hw01kl3PZao6N43 3IN1em8p8eJ51gwaxNiWhxlXwQ/HW6CIP9K0X9lRJOofa4aIzjTlzFw0dpzvv4Dq6Sn6+0ueDuk SNfY= X-Gm-Gg: ASbGncuUYC2FfbM2NRE+Er3sNTbaVtRP7o83W06JpMnu+Eh5fBY9Pviv9c9GKo1ky4+ ak3/8E88F2JBEIFWD8u3XGA2Bs79nawKgn6a/F+Ofw3exSz0FQYZPx2L9PvF7ejNGATiGoRHMWz x7L33ElOTw9Optqk1Va6H4odC99LXKydItgclH733l8U7Jna+pB7gYj+9MNoqtfn/OfJSHHp0Kk KJL1J0w6vpdXMCi1McBUNkdSKWU57d+rh0ctWbCVnwzlTO60wCLUMUfW/GQsvmhN80KHq6S9Jea gHbJ4GrYcXoLDqN+TYXN3VZMVA== X-Received: by 2002:a05:6a00:69ad:b0:725:f1e9:5334 with SMTP id d2e1a72fcca58-72aa9ade355mr28645965b3a.8.1735070726851; Tue, 24 Dec 2024 12:05:26 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Dec 2024 12:05:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 05/72] tcg/optimize: Copy mask writeback to fold_masks Date: Tue, 24 Dec 2024 12:04:14 -0800 Message-ID: <20241224200521.310066-6-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::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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 Use of fold_masks should be restricted to those opcodes that can reliably make use of it -- those with a single output, and from higher-level folders that set up the masks. Prepare for conversion of each folder in turn. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 6757fe0036..2aa57afd64 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1048,6 +1048,12 @@ static bool fold_masks(OptContext *ctx, TCGOp *op) { uint64_t z_mask = ctx->z_mask; uint64_t s_mask = ctx->s_mask; + const TCGOpDef *def = &tcg_op_defs[op->opc]; + TCGTemp *ts; + TempOptInfo *ti; + + /* Only single-output opcodes are supported here. */ + tcg_debug_assert(def->nb_oargs == 1); /* * 32-bit ops generate 32-bit results, which for the purpose of @@ -1059,14 +1065,19 @@ static bool fold_masks(OptContext *ctx, TCGOp *op) if (ctx->type == TCG_TYPE_I32) { z_mask = (int32_t)z_mask; s_mask |= MAKE_64BIT_MASK(32, 32); - ctx->z_mask = z_mask; - ctx->s_mask = s_mask; } if (z_mask == 0) { return tcg_opt_gen_movi(ctx, op, op->args[0], 0); } - return false; + + ts = arg_temp(op->args[0]); + reset_ts(ctx, ts); + + ti = ts_info(ts); + ti->z_mask = z_mask; + ti->s_mask = s_mask; + return true; } /*