From patchwork Fri Dec 20 04:10:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 852387 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp1853582wrq; Thu, 19 Dec 2024 20:19:00 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWN+vmqd8hK8vW5Y0saj1Z86QXHobGY60fD2C1Om89N/Qyp2w67MGRPl8dvahzwG6k3hOHXNQ==@linaro.org X-Google-Smtp-Source: AGHT+IElcLHqAVuYrDcNs6gOlVYcREi5f0KpAUiMU4cf8xqBXmmuNwnLR0hk61+hZRbaa2SVRxIg X-Received: by 2002:a05:622a:14c:b0:467:79b4:a103 with SMTP id d75a77b69052e-46a4a9a28b2mr29081221cf.51.1734668340085; Thu, 19 Dec 2024 20:19:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734668340; cv=none; d=google.com; s=arc-20240605; b=FH4YjmCPbHJtRu+rsvGaYymy1cv0RIYpwhD1Gv90fvkIrinq+CMeCNQy9hZuN4QdI6 vR/DVudqMPPlEmqhR5UjrM7g7V/ajX1Dka/ZMDj31Pi1Ocu+xUeCcPojRy0z5My2wA/+ KnKugDeSbEJw9jH8At05BH4rYWU+35UoZWmkXMUr0pROxfepDFtvp0Uekj/4h28mnh8k OHHKMZTApCUvFyd5MMGicY3ORwMfEgyHfywI1kgwYwFZORuqtriBpGyiEiLaxiX7lPd+ WrlTX4fMXv7br75SVF0Mp67etyEygWVxtz0q/PWDVHjWZDNEB48KMy1QqbKE+YN2wHNX jtOw== 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:message-id:date:subject:to:from:dkim-signature; bh=7T6q101ST/GzSlfq3xqwhdERPg88KHcGu7l3IJfyC/4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=L+Yh/CQ5ZpvV7qkAgF0HVKy5pTMx1oid2x3ouOFSZHJAh4RyK/t/mNr5Xrqzd8ty5S LlEKJNxzI+38YbYBQuFk/Qe6410r4UeSDeertwsiKQMakmxabz8qOq67g/FrJZ4/DdUx C47LhERraoy4/Hwsq9eSgEMXRM8unxApUHvL8x8q5f/NwTK99nQ1sADs15s+FevkrnnX 1Iz+ewLZRMeDi6HJIvm5iTOSdpHfmPO0JZ8eC6ha/xfnbp8L4GLAEQ/UBWgqFdtteUc0 V6cHb2PLbyNButJBULxDnQ8TtugjSGrMLiD6MlSQd+JvaVrgGuX7eov6ACjbW4mIo/Oi Vxvw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BE8DKlTh; 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-6dd181377d0si36433936d6.161.2024.12.19.20.18.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Dec 2024 20:19:00 -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=BE8DKlTh; 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 1tOUM5-0008LM-Hj; Thu, 19 Dec 2024 23:11:13 -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 1tOUM2-0008Ji-Uf for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:11 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUM0-0006Fw-4Z for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:10 -0500 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-2ee397a82f6so1397958a91.2 for ; Thu, 19 Dec 2024 20:11:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667867; x=1735272667; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=7T6q101ST/GzSlfq3xqwhdERPg88KHcGu7l3IJfyC/4=; b=BE8DKlTh/5DdxDY18c35MigqPr2PTnFXIAtpNDje17mtRaHaO2RBrbdHb8/pP7OgDk IFTUnpLEo8qdggB0v+R7u/5kZTb88aVCIOUiebzkUz3EtScMcHYVBeqeh+XSi7DZK8kT 8YACBAF871HnRP+Uko4qAuv+TYNE4w1sH0D3LOQ0du436lS+HLpC9Iu33DLXnkfDftKX Ll8ujOLroxO9Jz7OwE13D/+/6DH3oTMXTnMVfJ0mUFJahh6PAyBll23UdZPfRYkIoKhv rf3YGIe2rb3gMYFqtCgOEph1LZ12U9KrRPxGVKiS/fAqpalyynTvfC9YeC6uxmpHafVN dBwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667867; x=1735272667; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7T6q101ST/GzSlfq3xqwhdERPg88KHcGu7l3IJfyC/4=; b=F9uE6wy0aUVFcq9Lxfs2I7UUzJpvk0SrHU9Qtu8fK0FZ9+e3S5JTBxuxT5IonXyU7L IwsmbN8OVCWqh/H273JggjLMUpIVLDN1lv1jnXZY+MnNH1GD++UHnRpzDVWmZYCEpbFQ 80WkM+2VqFA3Sg3kOe70/7JXXW6Vhpa2ngTXJxxxLaRKeUsz7dCbrKUdJDgRJ07WXE8/ L/I1uPPtoNIB2NGzEi94IXAEKAhFB/vVTJ6/poL/fxqAVyrpX7n4a4XHr/nIUisVYtb1 PH2EXmGthNJmpgQ7i6ka24zfA/AF3oZf2uLYAheyalffrhXivI0S0EtuUPSy+Hs6YQJM UfoQ== X-Gm-Message-State: AOJu0YyskM8mB4BZqe2pTrTpbesNplywkzrzNtwdtPW7/x7EJoHZM9cg jW9vBD7GvwgRzGkkVt4TdfanZHZo9BHAgesWzxl1arBlhKrVjC5mAP6RbnDAp5qGW2V6ZDKaVqu g X-Gm-Gg: ASbGncsv6JkIESSqJjlQ3M6gycMUrMXmmDkE96vLZk+o4hIVotLQrIvLmZvt8+NAiza TbjjNNljeYbJsOC6qaobgfLOUxMqbLUemFz1H3qrjytgaQCq1kXlq5wJdewis7DKNgsPdccsjRr EYx2XMJFyFDO9WU9R+FPY+tltkj07JKBEWJJ0VsKfNMEM7v2vSiWopzFKGg3TAtPaaNBULsKU09 e0fmv7KZNVnWg43ojZwFp/wl8cOvkZorSl4TbXrfAGSRTEHZX6aOYLmPRDkksc= X-Received: by 2002:a17:90b:1f8a:b0:2ee:ad18:b309 with SMTP id 98e67ed59e1d1-2f452def24cmr2107091a91.3.1734667865486; Thu, 19 Dec 2024 20:11:05 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:05 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 00/51] tcg: Remove in-flight mask data from OptContext Date: Thu, 19 Dec 2024 20:10:12 -0800 Message-ID: <20241220041104.53105-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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 The desire is to start re-using some of the fold_* functions while lowering or simplifying operations during tcg_optmize. Many of these fold_* functions set z_mask, s_mask, and a_mask, which hang around until the end of the tcg_optmize loop and are applied by finish_folding. This disconnect between set and apply is a problem -- we would no longer be applying the masks to the correct opcode. Fix this by making the masks local variables, passed down to be applied immediately to the opcode being processed. Changes for v2: - Introduce fold_affected_mask, to handle a_mask separately from both z_mask and s_mask. There are only a couple of places where we can compute a_mask, and handling that separately simplifies some things. This means that fold_masks_zsa is gone, and fold_masks_za need not be created. - Introduce fold_masks_s, as suggested in review. - In many places, fetch the TempOptInfo pointers once. This doesn't affect the resulting optimized code, but it's easier to read. - There are a couple of logic fixes, separated out to new patches. - There are a couple of logic improvements for fold_count_zero and fold_deposit. Patches lacking review: 02-tcg-optimize-Split-out-fold_affected_mask.patch 04-tcg-optimize-Split-out-fold_masks_zs.patch 05-tcg-optimize-Augment-s_mask-from-z_mask-in-fold_m.patch 10-tcg-optimize-Use-fold_masks_zs-in-fold_count_zero.patch 13-tcg-optimize-Compute-sign-mask-in-fold_deposit.patch 29-tcg-optimize-Use-fold_masks_zs-in-fold_qemu_ld.patch 35-tcg-optimize-Fix-sign-mask-in-fold_negsetcond.patch 40-tcg-optimize-Canonicalize-s_mask-in-fold_exts-fol.patch 42-tcg-optimize-Simplify-sign-bit-test-in-fold_shift.patch r~ Richard Henderson (51): tcg/optimize: Split out finish_bb, finish_ebb tcg/optimize: Split out fold_affected_mask tcg/optimize: Copy mask writeback to fold_masks tcg/optimize: Split out fold_masks_zs tcg/optimize: Augment s_mask from z_mask in fold_masks_zs tcg/optimize: Use finish_folding in fold_add, fold_add_vec, fold_addsub2 tcg/optimize: Use fold_masks_zs in fold_and tcg/optimize: Use fold_masks_zs in fold_andc tcg/optimize: Use fold_masks_zs in fold_bswap tcg/optimize: Use fold_masks_zs in fold_count_zeros tcg/optimize: Use fold_masks_z in fold_ctpop tcg/optimize: Use fold_and and fold_masks_z in fold_deposit tcg/optimize: Compute sign mask in fold_deposit tcg/optimize: Use finish_folding in fold_divide tcg/optimize: Use finish_folding in fold_dup, fold_dup2 tcg/optimize: Use fold_masks_s in fold_eqv tcg/optimize: Use fold_masks_z in fold_extract tcg/optimize: Use finish_folding in fold_extract2 tcg/optimize: Use fold_masks_zs in fold_exts tcg/optimize: Use fold_masks_z in fold_extu tcg/optimize: Use fold_masks_zs in fold_movcond tcg/optimize: Use finish_folding in fold_mul* tcg/optimize: Use fold_masks_s in fold_nand tcg/optimize: Use fold_masks_z in fold_neg_no_const tcg/optimize: Use fold_masks_s in fold_nor tcg/optimize: Use fold_masks_s in fold_not tcg/optimize: Use fold_masks_zs in fold_or tcg/optimize: Use fold_masks_zs in fold_orc tcg/optimize: Use fold_masks_zs in fold_qemu_ld tcg/optimize: Return true from fold_qemu_st, fold_tcg_st tcg/optimize: Use finish_folding in fold_remainder tcg/optimize: Distinguish simplification in fold_setcond_zmask tcg/optimize: Use fold_masks_z in fold_setcond tcg/optimize: Use fold_masks_s in fold_negsetcond tcg/optimize: Fix sign mask in fold_negsetcond tcg/optimize: Use fold_masks_z in fold_setcond2 tcg/optimize: Use finish_folding in fold_cmp_vec tcg/optimize: Use finish_folding in fold_cmpsel_vec tcg/optimize: Use fold_masks_zs in fold_sextract tcg/optimize: Canonicalize s_mask in fold_exts, fold_sextract tcg/optimize: Use fold_masks_zs, fold_masks_s in fold_shift tcg/optimize: Simplify sign bit test in fold_shift tcg/optimize: Use finish_folding in fold_sub, fold_sub_vec tcg/optimize: Use fold_masks_zs in fold_tcg_ld tcg/optimize: Use finish_folding in fold_tcg_ld_memcopy tcg/optimize: Use fold_masks_zs in fold_xor tcg/optimize: Use finish_folding in fold_bitsel_vec tcg/optimize: Use finish_folding as default in tcg_optimize tcg/optimize: Remove z_mask, s_mask from OptContext tcg/optimize: Move fold_bitsel_vec into alphabetic sort tcg/optimize: Move fold_cmp_vec, fold_cmpsel_vec into alphabetic sort tcg/optimize.c | 776 +++++++++++++++++++++++++++---------------------- 1 file changed, 425 insertions(+), 351 deletions(-)