From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 81441 invoked by alias); 22 Feb 2018 21:19:23 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 81416 invoked by uid 89); 22 Feb 2018 21:19:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY,KAM_NUMSUBJECT,KAM_SHORT,RCVD_IN_DNSWL_LOW,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Feb 2018 21:19:20 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 303EC40FB639 for ; Thu, 22 Feb 2018 21:19:09 +0000 (UTC) Received: from topor.usersys.redhat.com (unused-10-15-17-214.yyz.redhat.com [10.15.17.214]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0DF4D2024CA9 for ; Thu, 22 Feb 2018 21:19:01 +0000 (UTC) From: Vladimir Makarov To: gcc-patches Subject: patch to fix PR81572 Message-ID: <2cef3e53-7af3-097c-cffc-b424fac19229@redhat.com> Date: Thu, 22 Feb 2018 21:19:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------FFB768D590AE68F673A6E74B" X-IsSubscribed: yes X-SW-Source: 2018-02/txt/msg01310.txt.bz2 This is a multi-part message in MIME format. --------------FFB768D590AE68F673A6E74B Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 177 The following patch fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81572 The patch was successfully bootstrapped and tested on ppc64. Committed as rev. 257915. --------------FFB768D590AE68F673A6E74B Content-Type: text/x-patch; name="pr81572.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr81572.patch" Content-length: 7713 Index: ChangeLog =================================================================== --- ChangeLog (revision 257901) +++ ChangeLog (working copy) @@ -1,3 +1,19 @@ +2018-02-22 Vladimir Makarov + + PR target/81572 + * lra-int.h (LRA_UNKNOWN_ALT, LRA_NON_CLOBBERED_ALT): New macros. + * lra.c (lra_set_insn_recog_data, lra_update_insn_recog_data): Use + LRA_UNKNOWN_ALT. + * lra-constraints.c (curr_insn_transform): Set up + LRA_NON_CLOBBERED_ALT for moves processed on the fast path. Use + LRA_UNKNOWN_ALT. + (remove_inheritance_pseudos): Use LRA_UNKNOWN_ALT. + * lra-eliminations.c (spill_pseudos): Ditto. + (process_insn_for_elimination): Ditto. + * lra-lives.c (reg_early_clobber_p): Use the new macros. + * lra-spills.c (spill_pseudos): Use LRA_UNKNOWN_ALT and + LRA_NON_CLOBBERED_ALT. + 2018-02-22 Martin Liska PR driver/83193 Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 257901) +++ lra-constraints.c (working copy) @@ -3730,7 +3730,13 @@ curr_insn_transform (bool check_only_p) curr_insn_set = single_set (curr_insn); if (curr_insn_set != NULL_RTX && simple_move_p ()) - return false; + { + /* We assume that the corresponding insn alternative has no + earlier clobbers. If it is not the case, don't define move + cost equal to 2 for the corresponding register classes. */ + lra_set_used_insn_alternative (curr_insn, LRA_NON_CLOBBERED_ALT); + return false; + } no_input_reloads_p = no_output_reloads_p = false; goal_alt_number = -1; @@ -3838,7 +3844,7 @@ curr_insn_transform (bool check_only_p) if (change_p) /* If we've changed the instruction then any alternative that we chose previously may no longer be valid. */ - lra_set_used_insn_alternative (curr_insn, -1); + lra_set_used_insn_alternative (curr_insn, LRA_UNKNOWN_ALT); if (! check_only_p && curr_insn_set != NULL_RTX && check_and_process_move (&change_p, &sec_mem_p)) @@ -3846,7 +3852,7 @@ curr_insn_transform (bool check_only_p) try_swapped: - reused_alternative_num = check_only_p ? -1 : curr_id->used_insn_alternative; + reused_alternative_num = check_only_p ? LRA_UNKNOWN_ALT : curr_id->used_insn_alternative; if (lra_dump_file != NULL && reused_alternative_num >= 0) fprintf (lra_dump_file, "Reusing alternative %d for insn #%u\n", reused_alternative_num, INSN_UID (curr_insn)); @@ -6752,7 +6758,7 @@ remove_inheritance_pseudos (bitmap remov } lra_push_insn_and_update_insn_regno_info (curr_insn); lra_set_used_insn_alternative_by_uid - (INSN_UID (curr_insn), -1); + (INSN_UID (curr_insn), LRA_UNKNOWN_ALT); done_p = true; if (lra_dump_file != NULL) { @@ -6791,7 +6797,7 @@ remove_inheritance_pseudos (bitmap remov constraints pass. */ lra_push_insn_and_update_insn_regno_info (curr_insn); lra_set_used_insn_alternative_by_uid - (INSN_UID (curr_insn), -1); + (INSN_UID (curr_insn), LRA_UNKNOWN_ALT); } else if (restored_regs_p) /* The instruction has been restored to the form that Index: lra-eliminations.c =================================================================== --- lra-eliminations.c (revision 257901) +++ lra-eliminations.c (working copy) @@ -1175,7 +1175,7 @@ spill_pseudos (HARD_REG_SET set) if (bitmap_bit_p (&to_process, INSN_UID (insn))) { lra_push_insn (insn); - lra_set_used_insn_alternative (insn, -1); + lra_set_used_insn_alternative (insn, LRA_UNKNOWN_ALT); } bitmap_clear (&to_process); } @@ -1408,7 +1408,7 @@ process_insn_for_elimination (rtx_insn * } lra_update_insn_regno_info (insn); lra_push_insn (insn); - lra_set_used_insn_alternative (insn, -1); + lra_set_used_insn_alternative (insn, LRA_UNKNOWN_ALT); } } Index: lra-int.h =================================================================== --- lra-int.h (revision 257901) +++ lra-int.h (working copy) @@ -202,15 +202,20 @@ struct lra_static_insn_data const struct operand_alternative *operand_alternative; }; +/* Negative insn alternative numbers used for special cases. */ +#define LRA_UNKNOWN_ALT -1 +#define LRA_NON_CLOBBERED_ALT -2 + /* LRA internal info about an insn (LRA internal insn representation). */ struct lra_insn_recog_data { /* The insn code. */ int icode; - /* The alternative should be used for the insn, -1 if invalid, or we - should try to use any alternative, or the insn is a debug - insn. */ + /* The alternative should be used for the insn, LRA_UNKNOWN_ALT if + unknown, or we should assume any alternative, or the insn is a + debug insn. LRA_NON_CLOBBERED_ALT means ignoring any earlier + clobbers for the insn. */ int used_insn_alternative; /* SP offset before the insn relative to one at the func start. */ poly_int64 sp_offset; Index: lra-lives.c =================================================================== --- lra-lives.c (revision 257901) +++ lra-lives.c (working copy) @@ -598,7 +598,9 @@ static inline bool reg_early_clobber_p (const struct lra_insn_reg *reg, int n_alt) { return (reg->early_clobber - && (n_alt < 0 || TEST_BIT (reg->early_clobber_alts, n_alt))); + && (n_alt == LRA_UNKNOWN_ALT + || (n_alt != LRA_NON_CLOBBERED_ALT + && TEST_BIT (reg->early_clobber_alts, n_alt)))); } /* Process insns of the basic block BB to update pseudo live ranges, Index: lra-spills.c =================================================================== --- lra-spills.c (revision 257901) +++ lra-spills.c (working copy) @@ -517,7 +517,7 @@ spill_pseudos (void) INSN_UID (insn)); lra_push_insn (insn); if (lra_reg_spill_p || targetm.different_addr_displacement_p ()) - lra_set_used_insn_alternative (insn, -1); + lra_set_used_insn_alternative (insn, LRA_UNKNOWN_ALT); } else if (CALL_P (insn) /* Presence of any pseudo in CALL_INSN_FUNCTION_USAGE Index: lra.c =================================================================== --- lra.c (revision 257901) +++ lra.c (working copy) @@ -958,7 +958,7 @@ lra_set_insn_recog_data (rtx_insn *insn) data = XNEW (struct lra_insn_recog_data); lra_insn_recog_data[uid] = data; data->insn = insn; - data->used_insn_alternative = -1; + data->used_insn_alternative = LRA_UNKNOWN_ALT; data->icode = icode; data->regs = NULL; if (DEBUG_INSN_P (insn)) @@ -1207,7 +1207,7 @@ lra_update_insn_recog_data (rtx_insn *in return data; } insn_static_data = data->insn_static_data; - data->used_insn_alternative = -1; + data->used_insn_alternative = LRA_UNKNOWN_ALT; if (DEBUG_INSN_P (insn)) return data; if (data->icode < 0) Index: testsuite/ChangeLog =================================================================== --- testsuite/ChangeLog (revision 257901) +++ testsuite/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2018-02-22 Vladimir Makarov + + PR target/81572 + * gcc.target/powerpc/pr81572.c: New. + 2018-02-22 Marek Polacek PR c++/84493 Index: testsuite/gcc.target/powerpc/pr81572.c =================================================================== --- testsuite/gcc.target/powerpc/pr81572.c (revision 0) +++ testsuite/gcc.target/powerpc/pr81572.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile { target powerpc64*-*-* } } */ +/* { dg-options "-O2 -mcpu=power7" } */ +/* { dg-final { scan-assembler-not "xxlor" } } */ + +#include + +typedef __vector unsigned char nvec_t; + +long testz_and(nvec_t a, nvec_t b) +{ + nvec_t c = vec_andc(a, b); + return vec_all_eq(a, c); +} --------------FFB768D590AE68F673A6E74B--