public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/66739] New: [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9]
@ 2015-07-02 12:35 schwab@linux-m68k.org
  2015-07-02 12:37 ` [Bug tree-optimization/66739] " schwab@linux-m68k.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2015-07-02 12:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66739

            Bug ID: 66739
           Summary: [6 regression] FAIL: gcc.target/aarch64/subs.c
                    scan-assembler subs\tw[0-9]
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: schwab@linux-m68k.org
                CC: rguenth at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64-*-*

$ gcc/xgcc -Bgcc/ ../gcc/testsuite/gcc.target/aarch64/subs.c -O2 -S -o subs.s
$ grep sub subs.s
        .file   "subs.c"
        sub     w1, w0, w1
        subs    x1, x0, x1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug tree-optimization/66739] [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9]
  2015-07-02 12:35 [Bug tree-optimization/66739] New: [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9] schwab@linux-m68k.org
@ 2015-07-02 12:37 ` schwab@linux-m68k.org
  2015-07-02 12:42 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2015-07-02 12:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66739

--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
fd425e6293fb8306af74b3048352d97e1d67b922 is the first bad commit

    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225249
138bc75d-0d04-0410-961f-82ee72b054a4


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug tree-optimization/66739] [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9]
  2015-07-02 12:35 [Bug tree-optimization/66739] New: [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9] schwab@linux-m68k.org
  2015-07-02 12:37 ` [Bug tree-optimization/66739] " schwab@linux-m68k.org
@ 2015-07-02 12:42 ` rguenth at gcc dot gnu.org
  2015-07-02 12:44 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-02 12:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66739

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-07-02
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Target Milestone|---                         |6.0
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
This is

  x = a - b;
  if (x != 0)

vs.

  if (a != b)

which we now more aggressively produce (the choice is not obvious and
we are missing the reverse transform).

The usual kind of action is to stick a single_use guard on the minus for

/* Transform comparisons of the form X - Y CMP 0 to X CMP Y.
   ??? The transformation is valid for the other operators if overflow
   is undefined for the type, but performing it here badly interacts
   with the transformation in fold_cond_expr_with_comparison which
   attempts to synthetize ABS_EXPR.  */
(for cmp (eq ne)
 (simplify
  (cmp (minus @0 @1) integer_zerop)
  (cmp @0 @1)))

but I really don't like that solution (it will cause SCCVN regressions).

value-numbering can also perform the reverse transform (though late
forwprop will kill that again).  I suppose we should look into
finding a more general solution for the forwprop issues from inside
forwprop.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug tree-optimization/66739] [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9]
  2015-07-02 12:35 [Bug tree-optimization/66739] New: [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9] schwab@linux-m68k.org
  2015-07-02 12:37 ` [Bug tree-optimization/66739] " schwab@linux-m68k.org
  2015-07-02 12:42 ` rguenth at gcc dot gnu.org
@ 2015-07-02 12:44 ` rguenth at gcc dot gnu.org
  2015-07-05 12:34 ` schwab@linux-m68k.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-02 12:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66739

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu.org

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
This case is special in the sense that a - b on some targets already computes
a - b != 0 but we don't have any way to represent this on GIMPLE.  This
also only works when a - b is computed "close" to the comparison.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug tree-optimization/66739] [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9]
  2015-07-02 12:35 [Bug tree-optimization/66739] New: [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9] schwab@linux-m68k.org
                   ` (2 preceding siblings ...)
  2015-07-02 12:44 ` rguenth at gcc dot gnu.org
@ 2015-07-05 12:34 ` schwab@linux-m68k.org
  2015-07-06 14:15 ` schwab@linux-m68k.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2015-07-05 12:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66739

--- Comment #4 from Andreas Schwab <schwab@linux-m68k.org> ---
This also breaks gcc.target/powerpc/405-nmacchw-2.c and
gcc.target/powerpc/440-nmacchw-2.c.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug tree-optimization/66739] [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9]
  2015-07-02 12:35 [Bug tree-optimization/66739] New: [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9] schwab@linux-m68k.org
                   ` (3 preceding siblings ...)
  2015-07-05 12:34 ` schwab@linux-m68k.org
@ 2015-07-06 14:15 ` schwab@linux-m68k.org
  2015-07-06 14:39 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2015-07-06 14:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66739

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dje at gcc dot gnu.org

--- Comment #5 from Andreas Schwab <schwab@linux-m68k.org> ---
*** Bug 66778 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug tree-optimization/66739] [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9]
  2015-07-02 12:35 [Bug tree-optimization/66739] New: [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9] schwab@linux-m68k.org
                   ` (4 preceding siblings ...)
  2015-07-06 14:15 ` schwab@linux-m68k.org
@ 2015-07-06 14:39 ` rguenth at gcc dot gnu.org
  2015-07-06 14:43 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-06 14:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66739

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
The ppc testcase,

int
f(int a, int b, int c)
{
  a -= (short)b * (c >> 16);
  if (!a)
    return 10;
  return a;
}

is probably artificially triggering the same issue.  Here we do not
test for conditional part but for an instruction used implementing
a -= (short)b * (c >> 16);

But it shows the same issue with the followup transform of sinking the
subtraction to the else path of the if.

I suppose a single-use test is the way to go together with some means to
"override" that when the caller is not going to create the result stmts
but will only perform lookups if the result is already computed (that applies
to all single-use tests).


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug tree-optimization/66739] [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9]
  2015-07-02 12:35 [Bug tree-optimization/66739] New: [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9] schwab@linux-m68k.org
                   ` (5 preceding siblings ...)
  2015-07-06 14:39 ` rguenth at gcc dot gnu.org
@ 2015-07-06 14:43 ` rguenth at gcc dot gnu.org
  2015-07-07  7:47 ` rguenth at gcc dot gnu.org
  2015-07-07  8:01 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-06 14:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66739

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
I am testing

Index: gcc/match.pd
===================================================================
--- gcc/match.pd        (revision 225453)
+++ gcc/match.pd        (working copy)
@@ -1336,8 +1353,9 @@ (define_operator_list CBRT BUILT_IN_CBRT
    attempts to synthetize ABS_EXPR.  */
 (for cmp (eq ne)
  (simplify
-  (cmp (minus @0 @1) integer_zerop)
-  (cmp @0 @1)))
+  (cmp (minus@2 @0 @1) integer_zerop)
+  (if (single_use (@2))
+   (cmp @0 @1))))

 /* Transform comparisons of the form X * C1 CMP 0 to X CMP 0 in the
    signed arithmetic case.  That form is created by the compiler


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug tree-optimization/66739] [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9]
  2015-07-02 12:35 [Bug tree-optimization/66739] New: [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9] schwab@linux-m68k.org
                   ` (6 preceding siblings ...)
  2015-07-06 14:43 ` rguenth at gcc dot gnu.org
@ 2015-07-07  7:47 ` rguenth at gcc dot gnu.org
  2015-07-07  8:01 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-07  7:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66739

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Tue Jul  7 07:46:57 2015
New Revision: 225502

URL: https://gcc.gnu.org/viewcvs?rev=225502&root=gcc&view=rev
Log:
2015-07-07  Richard Biener  <rguenther@suse.de>

        PR middle-end/66739
        * match.pd: Condition A - B ==/!= 0 -> A ==/!= B on single-use
        A - B.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/match.pd


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug tree-optimization/66739] [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9]
  2015-07-02 12:35 [Bug tree-optimization/66739] New: [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9] schwab@linux-m68k.org
                   ` (7 preceding siblings ...)
  2015-07-07  7:47 ` rguenth at gcc dot gnu.org
@ 2015-07-07  8:01 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-07  8:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66739

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Should be fixed now.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-07-07  8:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-02 12:35 [Bug tree-optimization/66739] New: [6 regression] FAIL: gcc.target/aarch64/subs.c scan-assembler subs\tw[0-9] schwab@linux-m68k.org
2015-07-02 12:37 ` [Bug tree-optimization/66739] " schwab@linux-m68k.org
2015-07-02 12:42 ` rguenth at gcc dot gnu.org
2015-07-02 12:44 ` rguenth at gcc dot gnu.org
2015-07-05 12:34 ` schwab@linux-m68k.org
2015-07-06 14:15 ` schwab@linux-m68k.org
2015-07-06 14:39 ` rguenth at gcc dot gnu.org
2015-07-06 14:43 ` rguenth at gcc dot gnu.org
2015-07-07  7:47 ` rguenth at gcc dot gnu.org
2015-07-07  8:01 ` rguenth at gcc dot gnu.org

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).