[Bug bootstrap/69709] [6 Regression] profiled bootstrap error on s390x-linux-gnu with r233194

2016-02-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69709

Jakub Jelinek  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |FIXED

--- Comment #15 from Jakub Jelinek  ---
Hopefully fixed then.

[Bug bootstrap/69709] [6 Regression] profiled bootstrap error on s390x-linux-gnu with r233194

2016-02-26 Thread krebbel at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69709

--- Comment #14 from Andreas Krebbel  ---
Author: krebbel
Date: Fri Feb 26 18:03:51 2016
New Revision: 233752

URL: https://gcc.gnu.org/viewcvs?rev=233752&root=gcc&view=rev
Log:
S/390: PR69709 Fix risbg splitter

This fixes a wrong code generation problem with the splitters introduced
with that patch: https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01840.html

The target operand is used as temporary.  This fails if it matches the
source of the left shift which is read after writing the temporary.

Thanks to Dominik for debugging it and thanks to Richard for the fix!

Bootstrapped and regtested on s390x with-arch=z13.

Bye,

-Andreas-

gcc/ChangeLog:

2016-02-26  Richard Henderson  

PR target/69709
* config/s390/s390.md (risbg and risbgn splitters): Allocate new
pseudo in case the target rtx matches the source of the left
shift.

gcc/testsuite/ChangeLog:

2016-02-26  Andreas Krebbel  

PR target/69709
* gcc.target/s390/pr69709.c: New test.


Added:
trunk/gcc/testsuite/gcc.target/s390/pr69709.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/s390/s390.md
trunk/gcc/testsuite/ChangeLog

[Bug bootstrap/69709] [6 Regression] profiled bootstrap error on s390x-linux-gnu with r233194

2016-02-25 Thread krebbel at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69709

--- Comment #13 from Andreas Krebbel  ---
Yes. This was problem. Your patch fixes this. Thanks!

[Bug bootstrap/69709] [6 Regression] profiled bootstrap error on s390x-linux-gnu with r233194

2016-02-25 Thread rth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69709

--- Comment #12 from Richard Henderson  ---
Created attachment 37799
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37799&action=edit
example patch

Or, for the purposes of combine, better like so.
This avoids creating a third (move) insn, which
will foil the 3->2 insn combination.

[Bug bootstrap/69709] [6 Regression] profiled bootstrap error on s390x-linux-gnu with r233194

2016-02-25 Thread rth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69709

Richard Henderson  changed:

   What|Removed |Added

 CC||rth at gcc dot gnu.org

--- Comment #11 from Richard Henderson  ---
Ho hum.  I've been looking at this this afternoon too.
Just to be sure we're on the same page, it's the insv
splitters not handling overlapping inputs.


diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index 2c90eae..a3f3f0a 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -3883,6 +3883,12 @@
 (ashift:GPR (match_dup 3) (match_dup 4]
 {
   operands[5] = GEN_INT ((1UL << UINTVAL (operands[4])) - 1);
+  if (rtx_equal_p (operands[0], operands[3]))
+{
+  if (!can_create_pseudo_p ())
+   FAIL;
+  operands[3] = copy_to_reg (operands[3]);
+}
 })

 (define_split
@@ -3903,6 +3909,12 @@
  (clobber (reg:CC CC_REGNUM))])]
 {
   operands[5] = GEN_INT ((1UL << UINTVAL (operands[4])) - 1);
+  if (rtx_equal_p (operands[0], operands[3]))
+{
+  if (!can_create_pseudo_p ())
+   FAIL;
+  operands[3] = copy_to_reg (operands[3]);
+}
 })

 (define_insn "*rsbg__noshift"

[Bug bootstrap/69709] [6 Regression] profiled bootstrap error on s390x-linux-gnu with r233194

2016-02-25 Thread vogt at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69709

--- Comment #10 from Dominik Vogt  ---
We've located the bug in the s390 backend.  No further help is needed.

[Bug bootstrap/69709] [6 Regression] profiled bootstrap error on s390x-linux-gnu with r233194

2016-02-25 Thread vogt at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69709

--- Comment #9 from Dominik Vogt  ---
(-fpeel-loops is activated by -fprofile-use, so this is the connection to
profilesbootstrap.)

[Bug bootstrap/69709] [6 Regression] profiled bootstrap error on s390x-linux-gnu with r233194

2016-02-25 Thread vogt at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69709

--- Comment #8 from Dominik Vogt  ---
Created attachment 37790
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37790&action=edit
Test case

The option -fpeel-loops triggers the bug.  The attached program has a different
result with -fpeel-loops than without it.

 $ gcc -O2 -march=z10 -fpeel-loops pr69709.c && ./a.out
 1 bits set in result
 $ gcc -O2 -march=z10 pr69709.c && ./a.out
 2 bits set in result

(2 is the correct result).

[Bug bootstrap/69709] [6 Regression] profiled bootstrap error on s390x-linux-gnu with r233194

2016-02-24 Thread vogt at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69709

--- Comment #7 from Dominik Vogt  ---
The stage1 compiler does something wrong when compiling gcc/real.c (with
-fprofile-generate).  The function div_significands() (inlined into
do_divide()) returns a wrong result due to bad register usage in this loop:

-- snip --
  do
{
  msb = u.sig[SIGSZ-1] & SIG_MSB;
  lshift_significand_1 (&u, &u);
start:
  if (msb || cmp_significands (&u, b) >= 0)
{
  sub_significands (&u, &u, b, 0);
  set_significand_bit (r, bit);
}
}
  while (--bit >= 0);
-- snip --

At loop entry ("start" label), r1 holds the highest 64 bits of the significand.
 The first pass through the loop seems to be correct; sub_significands() and
set_significand_bit() do the correct operations.  After that, r1 is decremented
by one as if it contained the variable "bit".  Later on r1 gets (eventually)
overwritten with zero.  After that, the loop always thinks that the remaining
significand is too smaller than b because its always zero.

In the end, the "result" of the division is one in the highest significand bit
and all other bits zero, eventually causing the observed assertion failure.

With a broken compiler (from stageprofile), the test program for triggering the
ICE is simply

-- snip --
int x = __DBL_MAX__;
-- snip --

All of this only happens on a Fedora 20 chroot for me.  I've tried to add
"-save-temps -dA -dP -fdump-rtl-all" to the OPT_FLAGS in the rpm spec file, but
then the package doesn't build at all.  Any hints how to get debug information
from the rembuild run is welcome.

[Bug bootstrap/69709] [6 Regression] profiled bootstrap error on s390x-linux-gnu with r233194

2016-02-23 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69709

--- Comment #6 from Jakub Jelinek  ---
FYI, profiledbootstrap works for me including Ada,
see
http://s390.koji.fedoraproject.org/packages/gcc/6.0.0/0.12.fc24/data/logs/s390x/build.log

[Bug bootstrap/69709] [6 Regression] profiled bootstrap error on s390x-linux-gnu with r233194

2016-02-17 Thread vogt at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69709

--- Comment #5 from Dominik Vogt  ---
@Matthias: So far it only happens for me when building a gcc rpm from source on
a (very slow VM), but not when compiling the same sources.  Is there anything
special about your build machine or environment on it?

[Bug bootstrap/69709] [6 Regression] profiled bootstrap error on s390x-linux-gnu with r233194

2016-02-17 Thread doko at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69709

--- Comment #4 from Matthias Klose  ---
still seen today; normal bootstrap works.

[Bug bootstrap/69709] [6 Regression] profiled bootstrap error on s390x-linux-gnu with r233194

2016-02-17 Thread vogt at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69709

Dominik Vogt  changed:

   What|Removed |Added

 CC||vogt at linux dot vnet.ibm.com

--- Comment #3 from Dominik Vogt  ---
Building the source Rpm you sent us (to build the Ada compiler) has the same
problem with profiledbootstrap, building on Fedora 20 (maybe other distros
too).  I'll try to isolate the problem.

[Bug bootstrap/69709] [6 Regression] profiled bootstrap error on s390x-linux-gnu with r233194

2016-02-17 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69709

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2016-02-17
 Ever confirmed|0   |1

--- Comment #2 from Jakub Jelinek  ---
Can you still reproduce this?  I've succeeded with several profiledbootstraps
on s390x-linux as well as s390-linux.

[Bug bootstrap/69709] [6 Regression] profiled bootstrap error on s390x-linux-gnu with r233194

2016-02-08 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69709

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek  ---
Strange, profiledbootstrap worked just fine for me during the weekend on
s390x-linux-gnu, but (with r233209 applied by hand) I got profiledbootstrap
failure on popwerpc64-linux-gnu (big endian) instead (ICE in reload).

[Bug bootstrap/69709] [6 Regression] profiled bootstrap error on s390x-linux-gnu with r233194

2016-02-08 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69709

Richard Biener  changed:

   What|Removed |Added

   Keywords||build
   Priority|P3  |P1
   Target Milestone|--- |6.0