Patchwork RFA: enable LRA for rs6000 [patch for WRF]

login
register
mail settings
Submitter Vladimir Makarov
Date April 25, 2013, 7:35 p.m.
Message ID <51798564.2040300@redhat.com>
Download mbox | patch
Permalink /patch/239588/
State New
Headers show

Comments

Vladimir Makarov - April 25, 2013, 7:35 p.m.
On 04/25/2013 11:29 AM, Vladimir Makarov wrote:
> On 04/24/2013 03:42 PM, Michael Meissner wrote:
>> I'm seeing a lot of failures with these changes in make check.
>>
> I've reproduced it, Mike.  I'll work on it.  Thanks.
>
I've fixed it, Mike.  It is on the branch now.

2013-04-25  Vladimir Makarov  <vmakarov@redhat.com>

         * config/rs6000/rs6000.c (rs6000_emit_move): Use assigned hard reg
         for LRA SD moves.
Michael Meissner - April 26, 2013, 3:30 p.m.
Vlad, in going through the LRA test differences, some of the bswap64 tests are
failing because LRA converts the swaps for register/register converts into
store/load.  For example, if gcc.target/powerpc/bswap64-4.c is compiled on
32-bit, for this function:

long long swap_reg (long long a) { return __builtin_bswap64 (a); }

LRA gives:

swap_reg:
        stwu 1,-16(1)
        li 9,4
        stw 3,8(1)
        stw 4,12(1)
        addi 10,1,8
        lwbrx 3,9,10
        lwbrx 4,0,10
        addi 1,1,16
        blr

And the traditional code generation is:

swap_reg:
        rlwinm 9,4,8,0xffffffff
        rlwinm 10,3,8,0xffffffff
        rlwimi 9,4,24,0,7
        rlwimi 10,3,24,0,7
        rlwimi 9,4,24,16,23
        rlwimi 10,3,24,16,23
        mr 4,10
        mr 3,9

I assume the rlwinm's are to be preferred because there is no LHS, and also in
this case, the 2 registers rlwinm's are done in parallel.

The test gcc.target/powerpc/vect-83_64.c is failing in LRA:

vect-83_64.c: In function ‘main1’:
vect-83_64.c:30:1: internal compiler error: Max. number of generated reload insns per insn is achieved (90)

 }
 ^
0x104dca7f lra_constraints(bool)
        /home/meissner/fsf-src/meissner-lra/gcc/lra-constraints.c:3613
0x104ca67b lra(_IO_FILE*)
        /home/meissner/fsf-src/meissner-lra/gcc/lra.c:2278
0x1047d6eb do_reload
        /home/meissner/fsf-src/meissner-lra/gcc/ira.c:4619
0x1047d6eb rest_of_handle_reload
        /home/meissner/fsf-src/meissner-lra/gcc/ira.c:4731
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

I'm also seeing quite a few Fortran failures for -m32:

gfortran.dg/PR19872.f
gfortran.dg/advance_1.f90
gfortran.dg/advance_4.f90
gfortran.dg/advance_5.f90
gfortran.dg/advance_6.f90
gfortran.dg/append_1.f90
gfortran.dg/associated_2.f90
gfortran.dg/assumed_rank_1.f90
gfortran.dg/assumed_rank_2.f90
gfortran.dg/assumed_rank_7.f90
gfortran.dg/assumed_type_2.f90
gfortran.dg/backspace_10.f90
gfortran.dg/backspace_2.f
gfortran.dg/backspace_8.f
gfortran.dg/backspace_9.f
gfortran.dg/bound_2.f90
gfortran.dg/bound_7.f90
gfortran.dg/bound_8.f90
gfortran.dg/char_cshift_1.f90
gfortran.dg/char_cshift_2.f90
gfortran.dg/char_cshift_3.f90
gfortran.dg/char_eoshift_1.f90
gfortran.dg/char_eoshift_2.f90
gfortran.dg/char_eoshift_3.f90
gfortran.dg/char_eoshift_4.f90
gfortran.dg/char_eoshift_5.f90
gfortran.dg/char_length_8.f90
gfortran.dg/chmod_1.f90
gfortran.dg/chmod_2.f90
gfortran.dg/chmod_3.f90
gfortran.dg/comma.f
gfortran.dg/convert_2.f90
gfortran.dg/convert_implied_open.f90
gfortran.dg/cr_lf.f90
gfortran.dg/cshift_bounds_1.f90
gfortran.dg/cshift_bounds_2.f90
gfortran.dg/cshift_bounds_3.f90
gfortran.dg/cshift_bounds_4.f90
gfortran.dg/cshift_nan_1.f90
gfortran.dg/dev_null.F90
gfortran.dg/direct_io_1.f90
gfortran.dg/direct_io_11.f90
gfortran.dg/direct_io_12.f90
gfortran.dg/direct_io_2.f90
gfortran.dg/direct_io_3.f90
gfortran.dg/direct_io_5.f90
gfortran.dg/direct_io_8.f90
gfortran.dg/endfile.f90
gfortran.dg/endfile_2.f90
gfortran.dg/eof_4.f90
gfortran.dg/eoshift.f90
gfortran.dg/eoshift_bounds_1.f90
gfortran.dg/error_format.f90
gfortran.dg/f2003_inquire_1.f03
gfortran.dg/f2003_io_1.f03
gfortran.dg/f2003_io_5.f03
gfortran.dg/f2003_io_7.f03
gfortran.dg/fmt_cache_1.f
gfortran.dg/fmt_error_4.f90
gfortran.dg/fmt_error_5.f90
gfortran.dg/fmt_t_5.f90
gfortran.dg/fmt_t_7.f
gfortran.dg/ftell_3.f90
gfortran.dg/hollerith4.f90
gfortran.dg/inquire_10.f90
gfortran.dg/inquire_13.f90
gfortran.dg/inquire_15.f90
gfortran.dg/inquire_9.f90
gfortran.dg/inquire_size.f90
gfortran.dg/iomsg_1.f90
gfortran.dg/iostat_2.f90
gfortran.dg/list_read_10.f90
gfortran.dg/list_read_6.f90
gfortran.dg/list_read_7.f90
gfortran.dg/list_read_9.f90
gfortran.dg/matmul_1.f90
gfortran.dg/matmul_5.f90
gfortran.dg/maxloc_bounds_1.f90
gfortran.dg/maxloc_bounds_2.f90
gfortran.dg/maxloc_bounds_3.f90
gfortran.dg/maxloc_bounds_6.f90
gfortran.dg/maxloc_bounds_8.f90
gfortran.dg/namelist_44.f90
gfortran.dg/namelist_45.f90
gfortran.dg/namelist_46.f90
gfortran.dg/namelist_66.f90
gfortran.dg/namelist_72.f
gfortran.dg/namelist_82.f90
gfortran.dg/negative_automatic_size.f90
gfortran.dg/negative_unit.f
gfortran.dg/negative_unit_int8.f
gfortran.dg/newunit_1.f90
gfortran.dg/newunit_3.f90
gfortran.dg/open_access_append_1.f90
gfortran.dg/open_errors.f90
gfortran.dg/open_negative_unit_1.f90
gfortran.dg/open_new.f90
gfortran.dg/open_readonly_1.f90
gfortran.dg/open_status_1.f90
gfortran.dg/open_status_2.f90
gfortran.dg/open_status_3.f90
gfortran.dg/optional_dim_2.f90
gfortran.dg/optional_dim_3.f90
gfortran.dg/overwrite_1.f
gfortran.dg/pr16597.f90
gfortran.dg/pr16935.f90
gfortran.dg/pr20954.f
gfortran.dg/pr39865.f90
gfortran.dg/pr46804.f90
gfortran.dg/pr47878.f90
gfortran.dg/read_comma.f
gfortran.dg/read_eof_4.f90
gfortran.dg/read_eof_8.f90
gfortran.dg/read_eof_all.f90
gfortran.dg/read_list_eof_1.f90
gfortran.dg/read_many_1.f
gfortran.dg/read_no_eor.f90
gfortran.dg/readwrite_unf_direct_eor_1.f90
gfortran.dg/realloc_on_assign_11.f90
gfortran.dg/realloc_on_assign_7.f03
gfortran.dg/record_marker_1.f90
gfortran.dg/record_marker_3.f90
gfortran.dg/runtime_warning_1.f90
gfortran.dg/selected_char_kind_1.f90
gfortran.dg/selected_char_kind_4.f90
gfortran.dg/shift-alloc.f90
gfortran.dg/shift-kind_2.f90
gfortran.dg/stat_1.f90
gfortran.dg/stat_2.f90
gfortran.dg/streamio_1.f90
gfortran.dg/streamio_10.f90
gfortran.dg/streamio_12.f90
gfortran.dg/streamio_14.f90
gfortran.dg/streamio_15.f90
gfortran.dg/streamio_16.f90
gfortran.dg/streamio_2.f90
gfortran.dg/streamio_3.f90
gfortran.dg/streamio_4.f90
gfortran.dg/streamio_5.f90
gfortran.dg/streamio_6.f90
gfortran.dg/streamio_7.f90
gfortran.dg/streamio_8.f90
gfortran.dg/streamio_9.f90
gfortran.dg/tl_editing.f90
gfortran.dg/unf_io_convert_1.f90
gfortran.dg/unf_io_convert_2.f90
gfortran.dg/unf_io_convert_3.f90
gfortran.dg/unf_io_convert_4.f90
gfortran.dg/unf_read_corrupted_1.f90
gfortran.dg/unf_short_record_1.f90
gfortran.dg/unformatted_subrecord_1.f90
gfortran.dg/unpack_bounds_1.f90
gfortran.dg/unpack_bounds_2.f90
gfortran.dg/unpack_bounds_3.f90
gfortran.dg/widechar_intrinsics_10.f90
gfortran.dg/widechar_intrinsics_5.f90
gfortran.dg/write_back.f
gfortran.dg/write_check.f90
gfortran.dg/write_check3.f90
gfortran.dg/write_direct_eor.f90
gfortran.dg/write_rewind_1.f
gfortran.dg/write_rewind_2.f
gfortran.dg/write_to_null.F90
gfortran.dg/x_slash_2.f
gfortran.dg/zero_sized_1.f90
gfortran.fortran-torture/execute/backspace.f90
gfortran.fortran-torture/execute/direct_io.f90
gfortran.fortran-torture/execute/inquire_1.f90
gfortran.fortran-torture/execute/inquire_2.f90
gfortran.fortran-torture/execute/inquire_3.f90
gfortran.fortran-torture/execute/inquire_4.f90
gfortran.fortran-torture/execute/inquire_5.f90
gfortran.fortran-torture/execute/intrinsic_associated.f90
gfortran.fortran-torture/execute/intrinsic_associated_2.f90
gfortran.fortran-torture/execute/intrinsic_cshift.f90
gfortran.fortran-torture/execute/intrinsic_eoshift.f90
gfortran.fortran-torture/execute/intrinsic_size.f90
gfortran.fortran-torture/execute/list_read_1.f90
gfortran.fortran-torture/execute/open_replace.f90
gfortran.fortran-torture/execute/seq_io.f90
gfortran.fortran-torture/execute/slash_edit.f90
gfortran.fortran-torture/execute/unopened_unit_1.f90
Michael Meissner - April 26, 2013, 6:04 p.m.
In addition to all of the failures in the 32-bit gfortrain suite, I ran one run
of the 32-bit spec 2006 fortan tests, and the following benchmarks fail:

	410.bwaves	416.gamess	434.zeusmp
	437.leslie3d	454.calculix	459.GemsFDTD
	465.tonto	481.wrf

The following 2 benchmarks succeed:

	435.gromacs	436.cactusADM
Vladimir Makarov - April 26, 2013, 11:01 p.m.
On 13-04-26 2:04 PM, Michael Meissner wrote:
> In addition to all of the failures in the 32-bit gfortrain suite, I ran one run
> of the 32-bit spec 2006 fortan tests, and the following benchmarks fail:
>
> 	410.bwaves	416.gamess	434.zeusmp
> 	437.leslie3d	454.calculix	459.GemsFDTD
> 	465.tonto	481.wrf
I'll work on this on Monday.
> The following 2 benchmarks succeed:
>
> 	435.gromacs	436.cactusADM
>
Michael Meissner - April 28, 2013, 2:07 a.m.
Note, this last patch does not bootstrap on powerpc:

/home/meissner/fsf-src/meissner-lra/gcc/lra-constraints.c: In function ‘bool process_alt_operands(int)’:
/home/meissner/fsf-src/meissner-lra/gcc/lra-constraints.c:2045:66: error:
‘small_class_operands_num’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]

I have set it to 0 in the declaration in my sources, to do the bootstrap.

Patch

Index: config/rs6000/rs6000.c
===================================================================
--- config/rs6000/rs6000.c      (revision 198263)
+++ config/rs6000/rs6000.c      (working copy)
@@ -7377,9 +7377,14 @@  rs6000_emit_move (rtx dest, rtx source,

        if (regno >= FIRST_PSEUDO_REGISTER)
     {
-         cl = reg_preferred_class (regno);
-         gcc_assert (cl != NO_REGS);
-         regno = ira_class_hard_regs[cl][0];
+         if (reg_renumber[regno] >= 0)
+           regno = reg_renumber[regno];
+         else
+           {
+             cl = reg_preferred_class (regno);
+             gcc_assert (cl != NO_REGS);
+             regno = ira_class_hard_regs[cl][0];
+           }
         }
        if (FP_REGNO_P (regno))
     {
@@ -7407,9 +7412,14 @@  rs6000_emit_move (rtx dest, rtx source,

        if (regno >= FIRST_PSEUDO_REGISTER)
         {
-         cl = reg_preferred_class (regno);
-         gcc_assert (cl != NO_REGS);
-         regno = ira_class_hard_regs[cl][0];
+         if (reg_renumber[regno] >= 0)
+           regno = reg_renumber[regno];
+         else
+           {
+             cl = reg_preferred_class (regno);
+             gcc_assert (cl != NO_REGS);
+             regno = ira_class_hard_regs[cl][0];
+           }
         }
        if (FP_REGNO_P (regno))
         {