[Bug testsuite/85368] [8/9 regression] phi-opt-11 test fails on IBM Z

2018-11-30 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85368

--- Comment #14 from Jakub Jelinek  ---
Author: jakub
Date: Fri Nov 30 23:26:41 2018
New Revision: 266700

URL: https://gcc.gnu.org/viewcvs?rev=266700=gcc=rev
Log:
PR testsuite/85368
* params.def (PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT): New param.
* tree-ssa-ifcombine.c (ifcombine_ifandif): If
--param logical-op-non-short-circuit is present, override
LOGICAL_OP_NON_SHORT_CIRCUIT value from the param.
* fold-const.c (fold_range_test, fold_truth_andor): Likewise.

* lib/target-supports.exp (logical_op_short_circuit): Remove.
* gcc.dg/builtin-bswap-7.c: Remove logical_op_short_circuit
effective target, drop -mbranch-cost= options from the test and
instead pass --param logical-op-non-short-circuit=0 or
--param logical-op-non-short-circuit=1 depending on what the
tests meant to test.
* gcc.dg/pr21643.c: Likewise.
* gcc.dg/tree-ssa/ssa-ifcombine-ccmp-2.c: Likewise.
* gcc.dg/tree-ssa/phi-opt-11.c: Likewise.
* gcc.dg/tree-ssa/ssa-ifcombine-ccmp-1.c: Likewise.
* gcc.dg/tree-ssa/ssa-dom-thread-4.c: Likewise.
* gcc.dg/tree-ssa/ssa-ifcombine-ccmp-3.c: Likewise.
* gcc.dg/tree-ssa/ssa-thread-14.c: Likewise.
* gcc.dg/tree-ssa/vrp47.c: Likewise.
* gcc.dg/tree-ssa/ssa-dom-thread-11.c: Likewise.
* gcc.dg/tree-ssa/ssa-dom-thread-16.c: Likewise.
* gcc.dg/tree-ssa/ssa-dom-thread-14.c: Likewise.
* gcc.dg/tree-ssa/ssa-ifcombine-ccmp-5.c: Likewise.
* gcc.dg/tree-ssa/vrp87.c: Likewise.
* gcc.dg/tree-ssa/ssa-ifcombine-ccmp-6.c: Likewise.
* gcc.dg/tree-ssa/phi-opt-2.c: Likewise.
* gcc.dg/tree-ssa/ssa-ifcombine-13.c: Likewise.
* gcc.dg/tree-ssa/ssa-thread-11.c: Likewise.
* gcc.dg/tree-ssa/ssa-ifcombine-ccmp-4.c: Likewise.
* gcc.dg/tree-ssa/forwprop-28.c: Likewise.
* gcc.dg/binop-xor1.c: Likewise.
* gcc.dg/pr46309.c: Likewise.
* gcc.dg/tree-ssa/ssa-dom-thread-18.c: New test.
* gcc.dg/tree-ssa/reassoc-32.c: Add
--param logical-op-non-short-circuit=1 to dg-options.
* gcc.dg/tree-ssa/reassoc-33.c: Likewise.
* gcc.dg/tree-ssa/reassoc-34.c: Likewise.
* gcc.dg/tree-ssa/reassoc-35.c: Likewise.
* gcc.dg/tree-ssa/reassoc-36.c: Likewise.

Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-18.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/fold-const.c
trunk/gcc/params.def
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/binop-xor1.c
trunk/gcc/testsuite/gcc.dg/builtin-bswap-7.c
trunk/gcc/testsuite/gcc.dg/pr21643.c
trunk/gcc/testsuite/gcc.dg/pr46309.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/forwprop-28.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-11.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-2.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/reassoc-32.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/reassoc-33.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/reassoc-34.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/reassoc-35.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/reassoc-36.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-11.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-14.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-16.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-4.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-13.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-1.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-2.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-3.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-4.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-5.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-6.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-11.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-14.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/vrp47.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/vrp87.c
trunk/gcc/testsuite/lib/target-supports.exp
trunk/gcc/tree-ssa-ifcombine.c

[Bug testsuite/85368] [8/9 regression] phi-opt-11 test fails on IBM Z

2018-11-30 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85368

Jakub Jelinek  changed:

   What|Removed |Added

  Attachment #45129|0   |1
is obsolete||

--- Comment #13 from Jakub Jelinek  ---
Created attachment 45132
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45132=edit
gcc9-pr85368.patch

Updated patch with those reassoc-3[23456].c tests adjusted.

[Bug testsuite/85368] [8/9 regression] phi-opt-11 test fails on IBM Z

2018-11-30 Thread clyon at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85368

--- Comment #12 from Christophe Lyon  ---
Hi Jakub, thanks for doing this.
I tested on many combination of arm* targets, and it was OK except for some of
them:
--target arm-none-eabi
--with-mode thumb
--with-cpu cortex-m3
--with-fpu default

--target arm-none-linux-gnueabihf
--with-mode thumb
--with-cpu cortex-a5
--with-fpu vfpv3-d16-fp16

Executed from: gcc.dg/tree-ssa/tree-ssa.exp
FAIL:gcc.dg/tree-ssa/reassoc-33.c scan-tree-dump-times reassoc1 "Optimizing
range tests" 3
FAIL:gcc.dg/tree-ssa/reassoc-34.c scan-tree-dump-times reassoc1 "Optimizing
range tests" 1
FAIL:gcc.dg/tree-ssa/reassoc-35.c scan-tree-dump-times reassoc1 "Optimizing
range tests" 1
FAIL:gcc.dg/tree-ssa/reassoc-36.c scan-tree-dump-times reassoc1 "Optimizing
range tests" 1

[Bug testsuite/85368] [8/9 regression] phi-opt-11 test fails on IBM Z

2018-11-30 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85368

--- Comment #11 from Jakub Jelinek  ---
It is enough to test it with:
cd build-dir/gcc
make check-gcc RUNTESTFLAGS="dg.exp='binop-xor1.c builtin-bswap-7.c pr21643.c
pr46309.c' tree-ssa.exp='forwprop-28.c phi-opt-11.c phi-opt-2.c reassoc-32.c
reassoc-33.c reassoc-34.c reassoc-35.c reassoc-36.c ssa-dom-thread-11.c
ssa-dom-thread-14.c ssa-dom-thread-16.c ssa-dom-thread-4.c ssa-dom-thread-18.c
ssa-ifcombine-13.c ssa-ifcombine-ccmp-1.c ssa-ifcombine-ccmp-2.c
ssa-ifcombine-ccmp-3.c ssa-ifcombine-ccmp-4.c ssa-ifcombine-ccmp-5.c
ssa-ifcombine-ccmp-6.c ssa-thread-11.c ssa-thread-14.c vrp47.c vrp87.c'"
apply patch
make cc1
repeat above make check-gcc

[Bug testsuite/85368] [8/9 regression] phi-opt-11 test fails on IBM Z

2018-11-30 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85368

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-11-30
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #10 from Jakub Jelinek  ---
Created attachment 45129
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45129=edit
gcc9-pr85368.patch

Untested fix through a new param.

Can folks test it before/after this patch please on various targets (powerpc,
arm non-cortex-m, arm cortex-m, s390x)?  I've tested it on x86_64-linux so far.

[Bug testsuite/85368] [8/9 regression] phi-opt-11 test fails on IBM Z

2018-11-30 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85368

--- Comment #9 from Jakub Jelinek  ---
Ah, arm ignores the BRANCH_COST altogether:
#define LOGICAL_OP_NON_SHORT_CIRCUIT\
  ((optimize_size)  \
   ? (TARGET_THUMB ? false : true)  \
   : TARGET_THUMB ? static_cast
(current_tune->logical_op_non_short_circuit_thumb) \
   : static_cast (current_tune->logical_op_non_short_circuit_arm))

I'd say we should throw away logical_op_non_short_circuit, branch_cost,
-mbranch-cost= from all the generic tests, and perhaps introduce --param
logical_op_non_short_circuit, which if set would override the target decision,
either to 0 or to 1, with the default of using the target macro.
Param rather than option to make it clear we can nuke it when we change the
early gimplification to ignore such decision and have some much later pass that
would adjust tests.

[Bug testsuite/85368] [8/9 regression] phi-opt-11 test fails on IBM Z

2018-11-28 Thread clyon at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85368

Christophe Lyon  changed:

   What|Removed |Added

 CC||clyon at gcc dot gnu.org

--- Comment #8 from Christophe Lyon  ---
I see a regression:
FAIL: gcc.dg/tree-ssa/phi-opt-11.c scan-tree-dump-times optimized "if" 0
(used to have PASS: gcc.dg/tree-ssa/phi-opt-11.c scan-tree-dump-times optimized
"if" 2)

on arm-none-eabi --with-mode thumb --with-cpu cortex-m3

Jakub said:
> I've tested it on x86_64 as example of
> !logical_op_short_circuit && branch_cost
> target, Jeff/Andreas on s390x as example
> of logical_op_short_circuit &&
> branch_cost target and I've tested on
> powerpc64{,le} as example of
> logical_op_short_circuit && !branch_cost target.
> arm is a branch_cost target and cortex-m3 is
> logical_op_short_circuit, why
> doesn't the -mbranch-cost=2 option override
> the cortex-m3 defaults?

That's not clear. We have:
#define BRANCH_COST(speed_p, predictable_p) \
  ((arm_branch_cost != -1) ? arm_branch_cost :  \
   (current_tune->branch_cost (speed_p, predictable_p)))

static int
arm_cortex_m_branch_cost (bool speed_p, bool predictable_p)
{
  return (TARGET_32BIT && speed_p) ? 1
 : arm_default_branch_cost (speed_p, predictable_p);
}

But since arm_branch_cost=2, we should just use that.

[Bug testsuite/85368] [8/9 regression] phi-opt-11 test fails on IBM Z

2018-11-28 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85368

--- Comment #7 from Jakub Jelinek  ---
Testcase actually changed in r266515, sorry for the inconvenience.

[Bug testsuite/85368] [8/9 regression] phi-opt-11 test fails on IBM Z

2018-11-28 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85368

--- Comment #6 from Jakub Jelinek  ---
Author: jakub
Date: Wed Nov 28 11:08:58 2018
New Revision: 266552

URL: https://gcc.gnu.org/viewcvs?rev=266552=gcc=rev
Log:
PR testsuite/85368
* gcc.dg/tree-ssa/phi-opt-11.c: For branch_cost targets, expect 0 ifs
rather than 0 or 2 depending on logical_op_short_circuit.

Modified:
trunk/gcc/testsuite/ChangeLog

[Bug testsuite/85368] [8/9 regression] phi-opt-11 test fails on IBM Z

2018-11-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85368

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek  ---
Created attachment 45072
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45072=edit
gcc9-pr85368.patch

So, does this fix it?  On branch_cost targets, we should IMHO always expect no
ifs because we pass -mbranch-cost=2 which makes it effectively a
non-logical_op_short_circuit target at compile time, whatever it has as
default.

Tested so far only on x86_64-linux as an example of !logical_op_short_circuit
&& branch_cost target.  Another target to try is s390x-linux as
logical_op_short_circuit && branch_cost target, then perhaps powerpc*-linux as
logical_op_short_circuit && !branch_cost target and perhaps even some
!logical_op_short_circuit && !branch_cost like ia64-*-linux* or others.

[Bug testsuite/85368] [8/9 regression] phi-opt-11 test fails on IBM Z

2018-07-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85368

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|8.2 |8.3

--- Comment #4 from Jakub Jelinek  ---
GCC 8.2 has been released.

[Bug testsuite/85368] [8/9 regression] phi-opt-11 test fails on IBM Z

2018-05-02 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85368

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|8.0 |8.2

--- Comment #3 from Jakub Jelinek  ---
GCC 8.1 has been released.