From: Naveen H.S Date: Fri, 30 Jun 2017 03:50:44 +0000 (+0000) Subject: aarch64.c (aarch_macro_fusion_pair_p): Push the check for CC usage into AARCH64_FUSE_... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=509f819a8e8ab900f303ea6ccdb8e90e97de7f3c;p=gcc.git aarch64.c (aarch_macro_fusion_pair_p): Push the check for CC usage into AARCH64_FUSE_CMP_BRANCH. 2017-06-29 Naveen H.S * config/aarch64/aarch64.c (aarch_macro_fusion_pair_p): Push the check for CC usage into AARCH64_FUSE_CMP_BRANCH. * config/i386/i386.c (ix86_macro_fusion_pair_p): Push the check for CC usage from generic code to here. * sched-deps.c (sched_macro_fuse_insns): Move the condition for CC usage into the target macros. From-SVN: r249827 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9dd05c60b3e..2c57178ef27 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2017-06-29 Naveen H.S + + * config/aarch64/aarch64.c (aarch_macro_fusion_pair_p): Push the + check for CC usage into AARCH64_FUSE_CMP_BRANCH. + * config/i386/i386.c (ix86_macro_fusion_pair_p): Push the check for + CC usage from generic code to here. + * sched-deps.c (sched_macro_fuse_insns): Move the condition for + CC usage into the target macros. + 2017-06-29 Maya Rashish * config/netbsd.h (NETBSD_LIB_SPEC): Add -lc when creating shared diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 5cf41fc0606..b8ce5af1592 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -14304,13 +14304,23 @@ aarch_macro_fusion_pair_p (rtx_insn *prev, rtx_insn *curr) { enum attr_type prev_type = get_attr_type (prev); - /* FIXME: this misses some which is considered simple arthematic - instructions for ThunderX. Simple shifts are missed here. */ - if (prev_type == TYPE_ALUS_SREG - || prev_type == TYPE_ALUS_IMM - || prev_type == TYPE_LOGICS_REG - || prev_type == TYPE_LOGICS_IMM) - return true; + 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)) + { + /* FIXME: this misses some which is considered simple arthematic + instructions for ThunderX. Simple shifts are missed here. */ + if (prev_type == TYPE_ALUS_SREG + || prev_type == TYPE_ALUS_IMM + || prev_type == TYPE_LOGICS_REG + || prev_type == TYPE_LOGICS_IMM) + return true; + } } return false; diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 9d53a6c869c..2c4479e1751 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -30345,6 +30345,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 b2393bf28fb..4c459e6587f 100644 --- a/gcc/sched-deps.c +++ b/gcc/sched-deps.c @@ -2834,34 +2834,30 @@ static void sched_macro_fuse_insns (rtx_insn *insn) { rtx_insn *prev; - + prev = prev_nonnote_nondebug_insn (insn); + if (!prev) + return; + 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; + if (reg_referenced_p (cc_reg_1, PATTERN (insn)) + && modified_in_p (cc_reg_1, prev)) + { + if (targetm.sched.macro_fusion_pair_p (prev, insn)) + SCHED_GROUP_P (insn) = 1; + return; + } } - else - { - rtx insn_set = single_set (insn); - - prev = prev_nonnote_nondebug_insn (insn); - if (!prev - || !insn_set - || !single_set (prev)) - return; + if (single_set (insn) && single_set (prev)) + { + if (targetm.sched.macro_fusion_pair_p (prev, insn)) + SCHED_GROUP_P (insn) = 1; } - - 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. */