https://gcc.gnu.org/g:a4a397c7d50224d9d3b5c6e0c9d246e600778c04

commit r17-5079-ga4a397c7d50224d9d3b5c6e0c9d246e600778c04
Author: Torbjörn SVENSSON <[email protected]>
Date:   Mon Oct 12 07:50:44 2026 +0200

    testsuite: Test both non-short-circuit settings for trapping comparisons
    
    fp-trapping-cmp-7.c was added in commit r17-4921-g8b90726a28bb63,
    but has never passed on Cortex-M targets that disable non-short-circuit
    operations.
    
    Split the test into two cases and set logical-op-non-short-circuit
    explicitly.  One test checks that the comparisons are kept separate
    when the parameter is 0, while the other checks that they are combined
    when it is 1.  This makes the tests independent of target tuning and
    covers both settings.
    
            PR tree-optimization/53805
    
    gcc/testsuite/ChangeLog:
    
            * gcc.dg/tree-ssa/fp-trapping-cmp-7.c: Pass --param
            logical-op-non-short-circuit=1.
            * gcc.dg/tree-ssa/fp-trapping-cmp-8.c: New test.
    
    Signed-off-by: Torbjörn SVENSSON <[email protected]>

Diff:
---
 gcc/testsuite/gcc.dg/tree-ssa/fp-trapping-cmp-7.c |  2 +-
 gcc/testsuite/gcc.dg/tree-ssa/fp-trapping-cmp-8.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/fp-trapping-cmp-7.c 
b/gcc/testsuite/gcc.dg/tree-ssa/fp-trapping-cmp-7.c
index 5916344877f6..51a6f3bc761b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/fp-trapping-cmp-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/fp-trapping-cmp-7.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O1 -ftrapping-math -fdump-tree-ifcombine-details" } */
+/* { dg-options "-O1 -ftrapping-math -fdump-tree-ifcombine-details --param 
logical-op-non-short-circuit=1" } */
 
 int
 f (double a, double b)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/fp-trapping-cmp-8.c 
b/gcc/testsuite/gcc.dg/tree-ssa/fp-trapping-cmp-8.c
new file mode 100644
index 000000000000..613379db378c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/fp-trapping-cmp-8.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftrapping-math -fdump-tree-ifcombine-details --param 
logical-op-non-short-circuit=0" } */
+
+int
+f (double a, double b)
+{
+  if (a > b)
+    if (a == b)
+      return 1;
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump-not "optimizing trapping cond to" "ifcombine" } 
} */
+/* { dg-final { scan-tree-dump-not "optimizing two comparisons to _\[0-9\]\+ & 
_\[0-9\]\+" "ifcombine" } } */

Reply via email to