public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6942] testsuite: Fix up tree-ssa/pr103514.c testcase [PR103514]
@ 2022-01-31  9:32 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2022-01-31  9:32 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:263a5944fc806396ecc3eff3d96277602e88ae2b

commit r12-6942-g263a5944fc806396ecc3eff3d96277602e88ae2b
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Jan 31 10:30:58 2022 +0100

    testsuite: Fix up tree-ssa/pr103514.c testcase [PR103514]
    
    > > PR tree-optimization/103514
    > >     * match.pd (a & b) ^ (a == b) -> !(a | b): New optimization.
    > >     * match.pd (a & b) == (a ^ b) -> !(a | b): New optimization.
    > >     * gcc.dg/tree-ssa/pr103514.c: Testcase for this optimization.
    > >
    > > 1) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103514
    > Note the bug was filed an fixed during stage3, review just didn't happen in
    > a reasonable timeframe.
    >
    > I'm going to ACK this for the trunk and go ahead and commit it for you.
    
    The testcase FAILs on short-circuit targets like powerpc64le-linux.
    While the first 2 functions are identical, the last two look like:
      <bb 2> :
      if (a_5(D) != 0)
        goto <bb 3>; [INV]
      else
        goto <bb 4>; [INV]
    
      <bb 3> :
      if (b_6(D) != 0)
        goto <bb 5>; [INV]
      else
        goto <bb 4>; [INV]
    
      <bb 4> :
    
      <bb 5> :
      # iftmp.1_4 = PHI <1(3), 0(4)>
      _1 = a_5(D) == b_6(D);
      _2 = (int) _1;
      _3 = _2 ^ iftmp.1_4;
      _9 = _2 != iftmp.1_4;
      return _9;
    instead of the expected:
      <bb 2> :
      _3 = a_8(D) & b_9(D);
      _4 = (int) _3;
      _5 = a_8(D) == b_9(D);
      _6 = (int) _5;
      _1 = a_8(D) | b_9(D);
      _2 = ~_1;
      _7 = (int) _2;
      _10 = ~_1;
      return _10;
    so no wonder it doesn't match.  E.g. x86_64-linux will also use jumps
    if it isn't just a && b but a && b && c && d (will do
    a & b and c & d tests and jump based on those.
    
    As it is too late to implement this optimization even for the short
    circuiting targets this late (not even sure which pass would be best),
    this patch just forces non-short-circuiting for the test.
    
    2022-01-31  Jakub Jelinek  <jakub@redhat.com>
    
            PR tree-optimization/103514
            * gcc.dg/tree-ssa/pr103514.c: Add
            --param logical-op-non-short-circuit=1 to dg-options.

Diff:
---
 gcc/testsuite/gcc.dg/tree-ssa/pr103514.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr103514.c b/gcc/testsuite/gcc.dg/tree-ssa/pr103514.c
index de3709ce396..2e813353d98 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr103514.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr103514.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-optimized" } */
+/* { dg-options "-O --param logical-op-non-short-circuit=1 -fdump-tree-optimized" } */
 #include <stdbool.h>
 
 bool
@@ -30,4 +30,4 @@ h (bool a, bool b)
 /* Make sure we have removed "==" and "^" and "&". */
 /* { dg-final { scan-tree-dump-not "&" "optimized"} } */
 /* { dg-final { scan-tree-dump-not "\\^"  "optimized"} } */
-/* { dg-final { scan-tree-dump-not "==" "optimized"} } */
\ No newline at end of file
+/* { dg-final { scan-tree-dump-not "==" "optimized"} } */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-31  9:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-31  9:32 [gcc r12-6942] testsuite: Fix up tree-ssa/pr103514.c testcase [PR103514] Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).