This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PING][PATCH] Move the check for any_condjump_p from sched-deps to target macros
- From: "Hurugalawadi, Naveen" <Naveen dot Hurugalawadi at cavium dot com>
- To: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Cc: "Pinski, Andrew" <Andrew dot Pinski at cavium dot com>, "roland dot illig at gmx dot de" <roland dot illig at gmx dot de>, "joseph at codesourcery dot com" <joseph at codesourcery dot com>, "dmalcolm at redhat dot com" <dmalcolm at redhat dot com>, nd <nd at arm dot com>, James Greenhalgh <james dot greenhalgh at arm dot com>, Marcus Shawcroft <marcus dot shawcroft at arm dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>, "ramana dot radhakrishnan at foss dot arm dot com" <ramana dot radhakrishnan at foss dot arm dot com>
- Date: Wed, 26 Apr 2017 12:50:31 +0000
- Subject: Re: [PING][PATCH] Move the check for any_condjump_p from sched-deps to target macros
- Authentication-results: sourceware.org; auth=none
- Authentication-results: cavium.com; dkim=none (message not signed) header.d=none;cavium.com; dmarc=none action=none header.from=cavium.com;
- References: <CO2PR07MB2694EE4FE1416466745550BC83330@CO2PR07MB2694.namprd07.prod.outlook.com>,<CO2PR07MB2694D5ED2A06E8D85BD18789831E0@CO2PR07MB2694.namprd07.prod.outlook.com>,<VI1PR0802MB2621A0766927C50FBBE1FAE6831E0@VI1PR0802MB2621.eurprd08.prod.outlook.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
Hi Wilco,
Thanks for reviewing the patch.
>> The return false seems incorrect - it means a core can either have
>> FUSE_CMP_BRANCH or FUSE_ALU_BRANCH but not both.
Thanks for pointing out about the confusion.
Modified the code as required.
Bootstrapped and Regression tested on AArch64 and X86_64.
Please review the patch and let us know if its okay?
Thanks,
Naveen
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 2e385c4..1a63ad0 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -13973,6 +13974,15 @@ aarch_macro_fusion_pair_p (rtx_insn *prev, rtx_insn *curr)
{
enum attr_type prev_type = get_attr_type (prev);
+ unsigned int condreg1, condreg2;
+ rtx cc_reg_1;
+ aarch64_fixed_condition_code_regs (&condreg1, &condreg2);
+ cc_reg_1 = gen_rtx_REG (CCmode, condreg1);
+ if (!reg_referenced_p (cc_reg_1, PATTERN (curr))
+ || !prev
+ || !modified_in_p (cc_reg_1, prev))
+ return true;
+
/* FIXME: this misses some which is considered simple arthematic
instructions for ThunderX. Simple shifts are missed here. */
if (prev_type == TYPE_ALUS_SREG
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 0b2fa1b..af14c90 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -29483,6 +29483,15 @@ ix86_macro_fusion_pair_p (rtx_insn *condgen, rtx_insn *condjmp)
if (!any_condjump_p (condjmp))
return false;
+ unsigned int condreg1, condreg2;
+ rtx cc_reg_1;
+ ix86_fixed_condition_code_regs (&condreg1, &condreg2);
+ cc_reg_1 = gen_rtx_REG (CCmode, condreg1);
+ if (!reg_referenced_p (cc_reg_1, PATTERN (condjmp))
+ || !condgen
+ || !modified_in_p (cc_reg_1, condgen))
+ return false;
+
if (get_attr_type (condgen) != TYPE_TEST
&& get_attr_type (condgen) != TYPE_ICMP
&& get_attr_type (condgen) != TYPE_INCDEC
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index b2393bf..b15a865 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -2835,33 +2835,16 @@ sched_macro_fuse_insns (rtx_insn *insn)
{
rtx_insn *prev;
- if (any_condjump_p (insn))
- {
- unsigned int condreg1, condreg2;
- rtx cc_reg_1;
- targetm.fixed_condition_code_regs (&condreg1, &condreg2);
- cc_reg_1 = gen_rtx_REG (CCmode, condreg1);
- prev = prev_nonnote_nondebug_insn (insn);
- if (!reg_referenced_p (cc_reg_1, PATTERN (insn))
- || !prev
- || !modified_in_p (cc_reg_1, prev))
- return;
- }
- else
- {
- rtx insn_set = single_set (insn);
-
- prev = prev_nonnote_nondebug_insn (insn);
- if (!prev
- || !insn_set
- || !single_set (prev))
- return;
+ rtx insn_set = single_set (insn);
- }
+ prev = prev_nonnote_nondebug_insn (insn);
+ if (!prev
+ || !insn_set
+ || !single_set (prev))
+ return;
if (targetm.sched.macro_fusion_pair_p (prev, insn))
SCHED_GROUP_P (insn) = 1;
-
}
/* Get the implicit reg pending clobbers for INSN and save them in TEMP. */