From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id CF4AC15813A for ; Mon, 13 Jan 2025 13:58:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F14F4E0802; Mon, 13 Jan 2025 13:58:58 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D46F6E0802 for ; Mon, 13 Jan 2025 13:58:58 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D803E335D0F for ; Mon, 13 Jan 2025 13:58:57 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 35DB31DC9 for ; Mon, 13 Jan 2025 13:58:56 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1736776729.b8a7e53a40d7938319d7673deba04c43952f84d8.sam@gentoo> Subject: [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/ X-VCS-Repository: proj/gcc-patches X-VCS-Files: 15.0.0/gentoo/82_all_PR118409-ifcombine.patch 15.0.0/gentoo/README.history X-VCS-Directories: 15.0.0/gentoo/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: b8a7e53a40d7938319d7673deba04c43952f84d8 X-VCS-Branch: master Date: Mon, 13 Jan 2025 13:58:56 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: ff8d2698-e80f-4cfa-aac7-5720cc3a6485 X-Archives-Hash: 0321d2b4ffcc0880b2e4c8f79509d781 commit: b8a7e53a40d7938319d7673deba04c43952f84d8 Author: Sam James gentoo org> AuthorDate: Mon Jan 13 13:58:49 2025 +0000 Commit: Sam James gentoo org> CommitDate: Mon Jan 13 13:58:49 2025 +0000 URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=b8a7e53a 15.0.0: drop upstream 82_all_PR118409-ifcombine.patch Merged upstream. Signed-off-by: Sam James gentoo.org> 15.0.0/gentoo/82_all_PR118409-ifcombine.patch | 154 -------------------------- 15.0.0/gentoo/README.history | 4 + 2 files changed, 4 insertions(+), 154 deletions(-) diff --git a/15.0.0/gentoo/82_all_PR118409-ifcombine.patch b/15.0.0/gentoo/82_all_PR118409-ifcombine.patch deleted file mode 100644 index 6362cd1..0000000 --- a/15.0.0/gentoo/82_all_PR118409-ifcombine.patch +++ /dev/null @@ -1,154 +0,0 @@ -https://inbox.sourceware.org/gcc-patches/ored17gz9x.fsf@lxoliva.fsfla.org/ - -From bfb791ad941348a0bb854b770f2294424528bc40 Mon Sep 17 00:00:00 2001 -Message-ID: -From: Alexandre Oliva -Date: Mon, 13 Jan 2025 00:37:14 -0300 -Subject: [PATCH] propagate signbit mask to XOR right-hand operand - -If a single-bit bitfield takes up the sign bit of a storage unit, -comparing the corresponding bitfield between two objects loads the -storage units, XORs them, converts the result to signed char, and -compares it with zero: ((signed char)(a. ^ c.) >= 0). - -fold_truth_andor_for_ifcombine recognizes the compare with zero as a -sign bit test, then it decomposes the XOR into an equality test. - -The problem is that, after this decomposition, that figures out the -width of the accessed fields, we apply the sign bit mask to the -left-hand operand of the compare, but we failed to also apply it to -the right-hand operand when both were taken from the same XOR. - -This patch fixes that. - -Regstrapped on x86_64-linux-gnu. Ok to install? - -for gcc/ChangeLog - - PR tree-optimization/118409 - * gimple-fold.cc (fold_truth_andor_for_ifcombine): Apply the - signbit mask to the right-hand XOR operand too. - -for gcc/testsuite/ChangeLog - -PR tree-optimization/118409 - * gcc.dg/field-merge-20.c: New. ---- - gcc/gimple-fold.cc | 20 +++++++++ - gcc/testsuite/gcc.dg/field-merge-20.c | 64 +++++++++++++++++++++++++++ - 2 files changed, 84 insertions(+) - create mode 100644 gcc/testsuite/gcc.dg/field-merge-20.c - -diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc -index a3987c4590ae..93ed8b3abb05 100644 ---- a/gcc/gimple-fold.cc -+++ b/gcc/gimple-fold.cc -@@ -8270,6 +8270,16 @@ fold_truth_andor_for_ifcombine (enum tree_code code, tree truth_type, - ll_and_mask = sign; - else - ll_and_mask &= sign; -+ if (l_xor) -+ { -+ if (!lr_and_mask.get_precision ()) -+ lr_and_mask = sign; -+ else -+ lr_and_mask &= sign; -+ if (l_const.get_precision ()) -+ l_const &= wide_int::from (lr_and_mask, -+ l_const.get_precision (), UNSIGNED); -+ } - } - - if (rsignbit) -@@ -8279,6 +8289,16 @@ fold_truth_andor_for_ifcombine (enum tree_code code, tree truth_type, - rl_and_mask = sign; - else - rl_and_mask &= sign; -+ if (r_xor) -+ { -+ if (!rr_and_mask.get_precision ()) -+ rr_and_mask = sign; -+ else -+ rr_and_mask &= sign; -+ if (r_const.get_precision ()) -+ r_const &= wide_int::from (rr_and_mask, -+ r_const.get_precision (), UNSIGNED); -+ } - } - - /* If either comparison code is not correct for our logical operation, -diff --git a/gcc/testsuite/gcc.dg/field-merge-20.c b/gcc/testsuite/gcc.dg/field-merge-20.c -new file mode 100644 -index 000000000000..44ac7fae50dc ---- /dev/null -+++ b/gcc/testsuite/gcc.dg/field-merge-20.c -@@ -0,0 +1,64 @@ -+/* { dg-do run } */ -+/* { dg-options "-O1" } */ -+ -+/* tree-optimization/118409 */ -+ -+/* Check that tests involving a sign bit of a storage unit are handled -+ correctly. The compares are turned into xor tests by earlier passes, and -+ ifcombine has to propagate the sign bit mask to the right hand of the -+ compare extracted from the xor, otherwise we'll retain unwanted bits for the -+ compare. */ -+ -+typedef struct { -+ int p : __CHAR_BIT__; -+ int d : 1; -+ int b : __CHAR_BIT__ - 2; -+ int e : 1; -+} g; -+ -+g a = {.d = 1, .e = 1}, c = {.b = 1, .d = 1, .e = 1}; -+ -+__attribute__((noipa)) -+int f1 () -+{ -+ if (a.d == c.d -+ && a.e == c.e) -+ return 0; -+ return -1; -+} -+ -+__attribute__((noipa)) -+int f2 () -+{ -+ if (a.d != c.d -+ || a.e != c.e) -+ return -1; -+ return 0; -+} -+ -+__attribute__((noipa)) -+int f3 () -+{ -+ if (c.d == a.d -+ && c.e == a.e) -+ return 0; -+ return -1; -+} -+ -+__attribute__((noipa)) -+int f4 () -+{ -+ if (c.d != a.d -+ || c.e != a.e) -+ return -1; -+ return 0; -+} -+ -+int main() { -+ if (f1 () < 0 -+ || f2 () < 0 -+ || f3 () < 0 -+ || f4 () < 0) -+ __builtin_abort(); -+ return 0; -+} - -base-commit: 0e05b793fba2a9bea9f0fbb1f068679f5dadf514 --- -2.48.0 - diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history index fdb33be..2789ef2 100644 --- a/15.0.0/gentoo/README.history +++ b/15.0.0/gentoo/README.history @@ -1,3 +1,7 @@ +39 ???? + + - 82_all_PR118409-ifcombine.patch + 38 13 January 2023 + 82_all_PR118409-ifcombine.patch