Bug 43484 - [4.5 Regression] GCC 4.5 does not build gamess, zeusmp on powerpc -m32 with loop unrolling
Summary: [4.5 Regression] GCC 4.5 does not build gamess, zeusmp on powerpc -m32 with l...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.5.0
: P1 major
Target Milestone: 4.5.0
Assignee: Michael Meissner
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2010-03-22 20:09 UTC by Michael Meissner
Modified: 2010-03-24 21:12 UTC (History)
3 users (show)

See Also:
Host: powerpc64-unknown-linux-gnu
Target: powerpc64-unknown-linux-gnu
Build: powerpc64-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2010-03-23 15:10:01


Attachments
Reduced function that causes the problem (5.57 KB, text/plain)
2010-03-22 20:11 UTC, Michael Meissner
Details
Patch to swap registers if first register is r0 in multi-word moves. (457 bytes, patch)
2010-03-24 18:00 UTC, Michael Meissner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Meissner 2010-03-22 20:09:27 UTC
If I build gamess and zeusmp with my normal spec optimization options, I get an internal compiler error in the change_address_1 function in emit-rtl.c, due to an address needing fixup has been generated after register allocation has been done.  I have narrowed the options down to -m32 -mcpu=power4 -O2 -funroll-loops that causes the problem.  I was able to build all of spec with the normal options on March 3rd.

foo.f: In function ‘gcidav’:
foo.f:670:0: internal compiler error: in change_address_1, at emit-rtl.c:1912
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Michael Meissner 2010-03-22 20:11:58 UTC
Created attachment 20164 [details]
Reduced function that causes the problem

To replicate this, use -m32 -O2 -mcpu=power4 -funroll-loops
Comment 2 Andrew Pinski 2010-03-22 20:49:28 UTC
apinski@apinski-desktop:~/src/gcc-fsf/local/gcc/objdir-ppc/gcc$ ./gfortran -B. t.f -S -m32 -mcpu=power4 -O2 -funroll-loops -v
Using built-in specs.
COLLECT_GCC=./gfortran
Target: powerpc64-linux-gnu
Configured with: ../configure --target=powerpc64-linux-gnu --enable-tls : (reconfigured) 
Thread model: posix
gcc version 4.5.0 20100322 (experimental) [trunk revision 157646] (GCC) 
COLLECT_GCC_OPTIONS='-B.' '-S' '-m32' '-mcpu=power4' '-O2' '-funroll-loops' '-v'
 ./f951 t.f -ffixed-form -quiet -dumpbase t.f -m32 -mcpu=power4 -auxbase t -O2 -version -funroll-loops -o t.s -fintrinsic-modules-path finclude
GNU Fortran (GCC) version 4.5.0 20100322 (experimental) [trunk revision 157646] (powerpc64-linux-gnu)
	compiled by GNU C version 4.3.2, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU Fortran (GCC) version 4.5.0 20100322 (experimental) [trunk revision 157646] (powerpc64-linux-gnu)
	compiled by GNU C version 4.3.2, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
COMPILER_PATH=./
LIBRARY_PATH=./
COLLECT_GCC_OPTIONS='-B.' '-S' '-m32' '-mcpu=power4' '-O2' '-funroll-loops' '-v'


This works for me with a cross, am I missing an option?
Comment 3 Michael Meissner 2010-03-22 21:02:44 UTC
I just replicated on my x86_64 cross compiler:

bug-43484.f: In function ‘gcidav’:
bug-43484.f:670:0: internal compiler error: in change_address_1, at emit-rtl.c:1912
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

I used the following configure options:
 --enable-languages=c,c++,fortran --enable-stage1-languages=c,c++,fortran --disable-bootstrap --enable-checking=release --enable-stage1-checking --enable-decimal-float --with-long-double-128 --enable-secureplt --target=powerpc64-linux --disable-shared --disable-libssp --enable-lto
Comment 4 Andrew Pinski 2010-03-22 21:04:31 UTC
>-with-long-double-128 --enable-secureplt

Those two options might cause the difference for me.  Let me reconfigure my build and try again.
Comment 5 Michael Meissner 2010-03-22 23:58:58 UTC
Subversion id 157525 does not abort, while subversion id 157540 does abort.

The GCC changelog includes these changes:
2010-03-18  Steven Bosscher  <steven@gcc.gnu.org>
           Eric Botcazou  <ebotcazou@adacore.com>

       PR rtl-optimization/43360
       * loop-invariant.c (move_invariant_reg): Remove the REG_EQUAL
       note if we don't know its invariant status.

2010-03-18  Michael Matz  <matz@suse.de>

       PR tree-optimization/43402
       * tree-cfgcleanup.c (cleanup_control_expr_graph): Don't follow
       PHI chains of ssa names registered for update.

2010-03-17  Peter Bergner  <bergner@vnet.ibm.com>

       PR target/42427
       * config/rs6000/rs6000.c (rs6000_split_multireg_move): Add support for
       non-offsettable and pre_modify update addressing.
       * config/rs6000/dfp.md (*movdd_hardfloat32): Make the "0", "1"
       and "2" alternatives "#".
       (*movdd_softfloat32): Make all alternatives "#";
       * config/rs6000/rs6000.md (DIFD): New define_mode_iterator.
       (*movdf_hardfloat32): Make the "0", "1" and "2" alternatives "#".
       (*movdf_softfloat32): Make all alternatives "#";
       (movdi): Use the new DIFD mode iterator to create a common splitter
       for movdi, movdf and movdd patterns.

2010-03-18  Shujing Zhao  <pearly.zhao@oracle.com>

       * common.opt (dumpdir): Remove redundant tab.

And the fortran Changelog includes:
2010-03-18  Shujing Zhao  <pearly.zhao@oracle.com>

       * lang.opt (-ffixed-line-length-, ffree-line-length-): Remove
       redundant tab.


more tomorrow.
Comment 6 Michael Meissner 2010-03-23 15:10:01 UTC
The rs6000 change on 2010-03-17 is the culprit.  If I do a svn update for the sandbox, and then do:
$ svn update -r157529 gcc/config/rs6000

There is no error.
Comment 7 Michael Meissner 2010-03-23 16:10:34 UTC
I forgot Peter was on vacation.  I'll take it.
Comment 8 Michael Meissner 2010-03-23 23:43:38 UTC
I have tracked down the issue, and will submit a patch tomorrow after further testing.  The issue is when a multi-word items is loaded to GPRS, and the address is of the form (r0+reg), the compiler was using r0 as the base register, which is not allowed in the powerpc architecture.
Comment 9 Michael Meissner 2010-03-24 18:00:20 UTC
Created attachment 20187 [details]
Patch to swap registers if first register is r0 in multi-word moves.

This patch fixes the problem in building the spec 2006 benchmarks zeusmp and gamess on the powerpc that was introduced in the 2010-03-17 change to rs6000.c.
Comment 10 Michael Meissner 2010-03-24 21:12:21 UTC
Patch checked in, subversion id  157709.