From patchwork Fri Apr 26 23:00:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 240058 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 8685F2C00B1 for ; Sat, 27 Apr 2013 09:00:52 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; q=dns; s= default; b=LF/vNpdq1Tj8BTAZX55oIFAj15sdQQmrfHQlqwvuQc5NxJjpOM7xn fs5SNUQfxvL4KGT0GhirtrUnT3pPGWTBdPIlOEmpNzqj61djTiP/Y/3rCkwK8zic AR3hh7bvmsF5kVLVRrD0swlj3UVeru3LEBx+MumUhui9OaCOMC/QFo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; s=default; bh=IHjpvOlxeeK1ymYS6xFsEzpsBvQ=; b=KdrFLKrEjM3CyydILq50ZlVGTfp9 /K+PsJM9aZuMFu02IuDfteKK+s44vlFsYqQuRwL33NerHtkhf7BVg27oUAxWpNGR HR3Kym2zjsVlipf6qlnbew/A5ugJLT9vz1tRfMk6yWKq7LEbjywo0/juLjuAnRq8 oHptUpo8n/HFHcw= Received: (qmail 12223 invoked by alias); 26 Apr 2013 23:00:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 12213 invoked by uid 89); 26 Apr 2013 23:00:45 -0000 X-Spam-SWARE-Status: No, score=-7.3 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS, TW_LW autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 26 Apr 2013 23:00:43 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3QN0fYa013024 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 26 Apr 2013 19:00:41 -0400 Received: from Mair.local (vpn-59-240.rdu2.redhat.com [10.10.59.240]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3QN0clG012784; Fri, 26 Apr 2013 19:00:38 -0400 Message-ID: <517B0715.2010100@redhat.com> Date: Fri, 26 Apr 2013 19:00:37 -0400 From: Vladimir Makarov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Michael Meissner , David Edelsohn , gcc-patches , "Bergner, Peter" , aavrunin@redhat.com Subject: Re: RFA: enable LRA for rs6000 References: <51758EF5.8050209@redhat.com> <20130422193149.GA5792@ibm-tiger.the-meissners.org> <5175D919.1070704@redhat.com> <5176A2D4.7020101@redhat.com> <5176AACE.9000307@redhat.com> <20130424194212.GA9758@ibm-tiger.the-meissners.org> <51794BC8.1020606@redhat.com> <51798564.2040300@redhat.com> <20130426153038.GA22890@ibm-tiger.the-meissners.org> In-Reply-To: <20130426153038.GA22890@ibm-tiger.the-meissners.org> On 13-04-26 11:30 AM, Michael Meissner wrote: > 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 for instructions. The patch below solved the above problems. The problem was in that I increased alternatives with '?' (although manual says that it should affect only regclass). It improves slightly x86/x86-64 generated code performance. But power has some strange insns with ???? (four ?). It looks a woodo to me. I've committed the patch into the branch. > I'm also seeing quite a few Fortran failures for -m32: It seems fixed too. > 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 > 2013-04-26 Vladimir Makarov * lra.c (setup_operand_alternative): Ignore '?'. * lra-constraints.c (process_alt_operands): Print cost dump for alternatives. Check only moves for cycling. (curr_insn_transform): Print insn name. Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 198344) +++ lra-constraints.c (working copy) @@ -2038,7 +2038,13 @@ process_alt_operands (int only_alternati or non-important thing to be worth to do it. */ overall = losers * LRA_LOSER_COST_FACTOR + reject; if ((best_losers == 0 || losers != 0) && best_overall < overall) - goto fail; + { + if (lra_dump_file != NULL) + fprintf (lra_dump_file, " alt=%d,overall=%d,losers=%d," + "small_class_ops=%d,rld_nregs=%d -- reject\n", + nalt, overall, losers, small_class_operands_num, reload_nregs); + goto fail; + } curr_alt[nop] = this_alternative; COPY_HARD_REG_SET (curr_alt_set[nop], this_alternative_set); @@ -2055,6 +2061,9 @@ process_alt_operands (int only_alternati early_clobbered_nops[early_clobbered_regs_num++] = nop; } if (curr_insn_set != NULL_RTX && n_operands == 2 + /* Prevent processing non-move insns. */ + && (GET_CODE (SET_SRC (curr_insn_set)) == SUBREG + || SET_SRC (curr_insn_set) == no_subreg_reg_operand[1]) && ((! curr_alt_win[0] && ! curr_alt_win[1] && REG_P (no_subreg_reg_operand[0]) && REG_P (no_subreg_reg_operand[1]) @@ -2162,6 +2171,10 @@ process_alt_operands (int only_alternati small_class_operands_num += SMALL_REGISTER_CLASS_P (curr_alt[nop]) ? 1 : 0; + if (lra_dump_file != NULL) + fprintf (lra_dump_file, " alt=%d,overall=%d,losers=%d," + "small_class_ops=%d,rld_nregs=%d\n", + nalt, overall, losers, small_class_operands_num, reload_nregs); /* If this alternative can be made to work by reloading, and it needs less reloading than the others checked so far, record it as the chosen goal for reloading. */ @@ -2518,7 +2531,6 @@ process_address (int nop, rtx *before, r code = -1; } } - } } if (code < 0) @@ -3007,6 +3019,9 @@ curr_insn_transform (void) for (; *p != '\0' && *p != ',' && *p != '#'; p++) fputc (*p, lra_dump_file); } + if (INSN_CODE (curr_insn) >= 0 + && (p = get_insn_name (INSN_CODE (curr_insn))) != NULL) + fprintf (lra_dump_file, " {%s}", p); fprintf (lra_dump_file, "\n"); } Index: lra.c =================================================================== --- lra.c (revision 198344) +++ lra.c (working copy) @@ -784,9 +784,6 @@ setup_operand_alternative (lra_insn_reco lra_assert (i != nop - 1); break; - case '?': - op_alt->reject += LRA_LOSER_COST_FACTOR; - break; case '!': op_alt->reject += LRA_MAX_REJECT; break;