From patchwork Sun Dec 22 16:24:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 852941 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp3036803wrq; Sun, 22 Dec 2024 08:33:16 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVSCA0SIwYgg2PIcihH3kVQ8wDQe+0lksIUv/zt4zXUkAbZXIy9FmljUmKtG2fi9lw0xSHxtw==@linaro.org X-Google-Smtp-Source: AGHT+IEFgx0cCSXYrsEqzBMvK7+rLN/rs8Gh0TLAtwg4LyU7oyTYUTeEgkLGW1vrWR6ds6Lfm9OX X-Received: by 2002:a05:620a:1b93:b0:7b6:e207:c8a2 with SMTP id af79cd13be357-7b9ba8202b5mr1876386385a.55.1734885195923; Sun, 22 Dec 2024 08:33:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734885195; cv=none; d=google.com; s=arc-20240605; b=KxWop3S+p2xV4qddKRU3iWoUdvIBfdslRUSVFFSfdR4DFCRe1GMCnKjVrPTPv6gCFQ qUvtccErAkS5Sd9Ip1PGFPPHhjSV0BjtGXZ1rA5S/WJXLFRTZeoh1MaOwYAhGCJLRPbt 4t4Q3AsV8Zd1iFYMylZTsszpeBaBznANOBbVqflBU2lZvCCbk5KysMHCBIbQiMZ9sZ53 hNj+9NuWOnt10DEPf+phiX4EkwYPTmm45w9Xp2coW2hDxXBY8q+iIDX4PyZrMz7pDRo6 /4TeKrXqAI/D9zLZAl1haS4oJtWX3v/EJlRQS1RwYYMY+shf37CtVpVvbSxIyNqiUtr9 /MTA== 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=sLGJPFNJ8wfTFpeecaPk1zjZBnM4p3X0KbI5v3Dflro=; fh=vm85eyWrvOAHduw3sqEA+cYBqvHB7M0MHFcRJg7VWOo=; b=AuclJQg+7rnHDtqJ6MFvP6QwyL2xqcl4eI+CSVrIbUv9PP6D3vrLkobISvITBwUY8P A3S7tJr82YGWQ6+GVdpVKrrXWPbIiCfzYO1GdH9pOfb6YTYFgsX7JKDwZ0tTDw0BL2vg 3pqLwfKshjx/hiRMsG2D7eHGUdDFUS4lioJu0A/jquKIKEH2acyHTq2CakEvickEWXFn vo1up1TlrB2I/VelLsHcFryqcExncJyWzkNA0j1hresQ0nljL3JEvEt6CHKHaHO8xHXY cgKX9vhA2aU/bKNdf86s17GVxEb0IErMIqwIjrqwPv8PQQ/ers384qbjltdBzDc7Fjlt NhvQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="K0/ojJkQ"; 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-7b9ac51fc5asi915048385a.592.2024.12.22.08.33.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Dec 2024 08:33:15 -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="K0/ojJkQ"; 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 1tPOlv-0002x7-Ul; Sun, 22 Dec 2024 11:25:39 -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 1tPOlN-0002at-Qg for qemu-devel@nongnu.org; Sun, 22 Dec 2024 11:25:07 -0500 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tPOlK-0002zb-Tj for qemu-devel@nongnu.org; Sun, 22 Dec 2024 11:25:05 -0500 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-2164b1f05caso31193415ad.3 for ; Sun, 22 Dec 2024 08:25:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734884700; x=1735489500; 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=sLGJPFNJ8wfTFpeecaPk1zjZBnM4p3X0KbI5v3Dflro=; b=K0/ojJkQEkya+EeYiQd9Dyh0H8rWlD/Kx5Jg0OpkSuqcpKrj0rG4cwdL7NMdpkjFqD JlGXF9A9urmIQOderlQOX3dXkGUQQkz0k71Y6r9LDed1wTbMxglz5jBC1w/10IOk0eTa tL6XgZF4Ixh/+S58LzPkBve3DIxyILuLbi+J/MBFnnAiTAB80GEJl2NcdsPiDbtdP/Ow s1EVYaD1H2ek8CZ1T/y6xSsbCptU2et81W1Oa1vi7r4YpBPoi25v/WaHOzvEyXzBIYUw G9LAqIfDvX/5FC/4nNoQS5llOmtT7/ZrVTOdTx+3pw+612TMLNC5aVYnv8zR2T7mIScG ytlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734884700; x=1735489500; 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=sLGJPFNJ8wfTFpeecaPk1zjZBnM4p3X0KbI5v3Dflro=; b=Dhv0x3zwkJEfT2dPvqCllPFAsEGya0/CnR8MroDBjdDKitUPybsmt2wuPI3vSTNpab IBzKBnHm0r1VsB675V+KStb9/Wb/F7VkEW4XXaCOfnbvSSJuTg0FxU39dWSzQwGzO82W JYpCtHqxEvCbqKAQKTI+N9xoDmgOzZwzKxOM9HUjbsaLKrPc9C6QhhnXQ1giTJTLV49w OsprtjAlwbpaT93KE4hSpqQtzBtGkmmOYaA/dQKkRzXNHypURsINki8nj2bB/k2ES3Ac hO83ftwX++oZPTAt+B6XvjuCHpgqVB59JQ4EdR8+gPIhfzQ/sqHtO2LFlUvfLXPGyzTr V8Dg== X-Gm-Message-State: AOJu0YzNktWd3mwCFqllX58eDJHpxs/2DhRXBhmXTkOcCNbNLyz0Kzx0 3cjskQvW8tnfNTKhbGNcGHGHV8ZPOG8REO/FlW6qM7F/ZOWlge4C3VigDm59EmDC+mfSl6NBGZF Cr4Q= X-Gm-Gg: ASbGncsFgfRfoKIKtMMQORBVgwnb0/4RAdwgdWrDggLIp/oeQCSL5Lzm9C/joTiCet4 1vmUbf3wSsLuZ9GAiLRqa4Rl1Nyi1yKQNMdUgOIuHua2B1z3yG6dUstOqPUFD/5lR+LkjF1gDFb AN7jnwRRYPz4PPrrgml4U3UryAka9d7BLjBtcQfJuSYR0eKs7WGYKoiZUofetdkwy0b1yj/kRwJ bPIuJ6JihCzrYK7nNbK3GlQg2AplNTxwmvpy/QzjbXINnFtItl9jo8vuQh2Uqo= X-Received: by 2002:a17:903:41c3:b0:216:69ca:773b with SMTP id d9443c01a7336-219e6e8c3d6mr146715085ad.5.1734884700332; Sun, 22 Dec 2024 08:25:00 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc971814sm58461385ad.79.2024.12.22.08.24.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Dec 2024 08:25:00 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v3 20/51] tcg/optimize: Use fold_masks_zs in fold_exts Date: Sun, 22 Dec 2024 08:24:15 -0800 Message-ID: <20241222162446.2415717-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241222162446.2415717-1-richard.henderson@linaro.org> References: <20241222162446.2415717-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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. Explicitly sign-extend z_mask instead of doing that manually. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index f05110cb9f..ab8ce1de2a 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1761,49 +1761,44 @@ static bool fold_extract2(OptContext *ctx, TCGOp *op) static bool fold_exts(OptContext *ctx, TCGOp *op) { - uint64_t s_mask_old, s_mask, z_mask, sign; + uint64_t s_mask_old, s_mask, z_mask; bool type_change = false; + TempOptInfo *t1; if (fold_const1(ctx, op)) { return true; } - z_mask = arg_info(op->args[1])->z_mask; - s_mask = arg_info(op->args[1])->s_mask; + t1 = arg_info(op->args[1]); + z_mask = t1->z_mask; + s_mask = t1->s_mask; s_mask_old = s_mask; switch (op->opc) { CASE_OP_32_64(ext8s): - sign = INT8_MIN; - z_mask = (uint8_t)z_mask; + s_mask |= INT8_MIN; + z_mask = (int8_t)z_mask; break; CASE_OP_32_64(ext16s): - sign = INT16_MIN; - z_mask = (uint16_t)z_mask; + s_mask |= INT16_MIN; + z_mask = (int16_t)z_mask; break; case INDEX_op_ext_i32_i64: type_change = true; QEMU_FALLTHROUGH; case INDEX_op_ext32s_i64: - sign = INT32_MIN; - z_mask = (uint32_t)z_mask; + s_mask |= INT32_MIN; + z_mask = (int32_t)z_mask; break; default: g_assert_not_reached(); } - if (z_mask & sign) { - z_mask |= sign; - } - s_mask |= sign << 1; - - ctx->z_mask = z_mask; - ctx->s_mask = s_mask; if (0 && !type_change && fold_affected_mask(ctx, op, s_mask & ~s_mask_old)) { return true; } - return fold_masks(ctx, op); + return fold_masks_zs(ctx, op, z_mask, s_mask); } static bool fold_extu(OptContext *ctx, TCGOp *op)