On 18/01/16 11:49, Jakub Jelinek wrote:
On Mon, Jan 18, 2016 at 11:38:37AM +0000, Kyrill Tkachov wrote:
On 18/01/16 11:31, Andreas Schwab wrote:
Jeff Law <l...@redhat.com> writes:

commit 1384b36abcd52a7ac72ca6538afa2aed2e04f8e0
Author: Jeff Law <l...@tor.usersys.redhat.com>
Date:   Fri Jan 15 17:15:24 2016 -0500

        PR tree-optimization/69270
        * tree-ssanames.c (ssa_name_has_boolean_range): Moved here from
        tree-ssa-dom.c.  Improve test for [0..1] ranve from VRP.
        * tree-ssa-dom.c (ssa_name_has_boolean_range): Remove.
        * tree-ssanames.h (ssa_name_has_boolean_range): Prototype.
        * tree-ssa-uncprop.c (associate_equivalences_with_edges): Use
        ssa_name_has_boolean_range and constant_boolean_node.
        PR tree-optimization/69270
        * gcc.dg/tree-ssa/pr69270-2.c: New test.
        * gcc.dg/tree-ssa/pr69270-3.c: New test.
This breaks gcc.target/aarch64/tst_3.c.

        //.tune generic
        .type   f1, %function
  f1:
-       tst     x0, 1
-       csinc   w0, w0, wzr, eq
+       ands    w1, w0, 1
+       csel    w0, w1, w0, ne
        ret
        .size   f1, .-f1
The two sequences look equally valid to me.
Instead of doing an and-compare followed by a conditional increment
we do an and-compare followed by a conditional select (without discarding
the result of the and).
So the testcase should be adjusted.
I'll do it.
IMHO please wait for the resolution of PR69320 here.

Ok, but both sequences should be ok for aarch64 here.
The function in the test is:
int
f1 (int x)
{
  if (x & 1)
    return 1;
  return x;
}

and the "return 1" should just be changed to "return 2" to avoid whatever
optimiser decided to perform that transformation.

Kyrill

Reply via email to