From: Kyrylo Tkachov Date: Mon, 24 Nov 2014 11:09:59 +0000 (+0000) Subject: [sched-deps] Remove needless check for modified_in_p when trying to fuse two non... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=892d9879a895ac23e8672a0817c4cfd0af253bca;p=gcc.git [sched-deps] Remove needless check for modified_in_p when trying to fuse two non-conditional jump insns * sched-deps.c (sched_macro_fuse_insns): Do not check modified_in_p in the not conditional jump case. * doc/tm.texi (TARGET_SCHED_MACRO_FUSION_PAIR_P): Update description. * target.def (TARGET_SCHED_MACRO_FUSION_PAIR_P): Update description. * gcc.target/aarch64/fuse_adrp_add_1.c: New test. From-SVN: r218012 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0835501cf30..0db7927f2a2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-11-24 Kyrylo Tkachov + + * sched-deps.c (sched_macro_fuse_insns): Do not check modified_in_p + in the not conditional jump case. + * doc/tm.texi (TARGET_SCHED_MACRO_FUSION_PAIR_P): Update description. + * target.def (TARGET_SCHED_MACRO_FUSION_PAIR_P): Update description. + 2014-11-24 Kyrylo Tkachov * config/aarch64/aarch64.c: Include tm-constrs.h diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 5b9da4776a1..c54fc71788c 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -6484,11 +6484,13 @@ cycle. These other insns can then be taken into account properly. This hook is used to check whether target platform supports macro fusion. @end deftypefn -@deftypefn {Target Hook} bool TARGET_SCHED_MACRO_FUSION_PAIR_P (rtx_insn *@var{condgen}, rtx_insn *@var{condjmp}) -This hook is used to check whether two insns could be macro fused for -target microarchitecture. If this hook returns true for the given insn pair -(@var{condgen} and @var{condjmp}), scheduler will put them into a sched -group, and they will not be scheduled apart. +@deftypefn {Target Hook} bool TARGET_SCHED_MACRO_FUSION_PAIR_P (rtx_insn *@var{prev}, rtx_insn *@var{curr}) +This hook is used to check whether two insns should be macro fused for +a target microarchitecture. If this hook returns true for the given insn pair +(@var{prev} and @var{curr}), the scheduler will put them into a sched +group, and they will not be scheduled apart. The two insns will be either +two SET insns or a compare and a conditional jump and this hook should +validate any dependencies needed to fuse the two insns together. @end deftypefn @deftypefn {Target Hook} void TARGET_SCHED_DEPENDENCIES_EVALUATION_HOOK (rtx_insn *@var{head}, rtx_insn *@var{tail}) diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c index a4ea8362a6a..ee534b02ef8 100644 --- a/gcc/sched-deps.c +++ b/gcc/sched-deps.c @@ -2877,8 +2877,7 @@ sched_macro_fuse_insns (rtx_insn *insn) prev = prev_nonnote_nondebug_insn (insn); if (!prev || !insn_set - || !single_set (prev) - || !modified_in_p (SET_DEST (insn_set), prev)) + || !single_set (prev)) return; } diff --git a/gcc/target.def b/gcc/target.def index dc48ae6912e..7c0296d58e4 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -1067,11 +1067,13 @@ DEFHOOK DEFHOOK (macro_fusion_pair_p, - "This hook is used to check whether two insns could be macro fused for\n\ -target microarchitecture. If this hook returns true for the given insn pair\n\ -(@var{condgen} and @var{condjmp}), scheduler will put them into a sched\n\ -group, and they will not be scheduled apart.", - bool, (rtx_insn *condgen, rtx_insn *condjmp), NULL) + "This hook is used to check whether two insns should be macro fused for\n\ +a target microarchitecture. If this hook returns true for the given insn pair\n\ +(@var{prev} and @var{curr}), the scheduler will put them into a sched\n\ +group, and they will not be scheduled apart. The two insns will be either\n\ +two SET insns or a compare and a conditional jump and this hook should\n\ +validate any dependencies needed to fuse the two insns together.", + bool, (rtx_insn *prev, rtx_insn *curr), NULL) /* The following member value is a pointer to a function called after evaluation forward dependencies of insns in chain given diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 89b181fc1af..b3d827fe6ab 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-11-24 Kyrylo Tkachov + + * gcc.target/aarch64/fuse_adrp_add_1.c: New test. + 2014-11-24 Richard Biener PR testsuite/64039 diff --git a/gcc/testsuite/gcc.target/aarch64/fuse_adrp_add_1.c b/gcc/testsuite/gcc.target/aarch64/fuse_adrp_add_1.c new file mode 100644 index 00000000000..074c629469b --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/fuse_adrp_add_1.c @@ -0,0 +1,45 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -mcpu=cortex-a57" } */ + +enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS, + XGRF_REGS, ALL_REGS, LIM_REG_CLASSES }; + +enum rtx_code { REG, LAST_AND_UNUSED_RTX_CODE }; + +typedef union rtunion_def +{ + int rtint; +} rtunion; + +typedef struct rtx_def +{ + unsigned int volatil : 1; + rtunion fld[1]; +} *rtx; + +extern char fixed_regs[64]; +extern char global_regs[64]; + +int +rtx_cost (rtx x, int outer_code) +{ + register enum rtx_code code; + switch (code) + { + case REG: + return ! ((((x)->volatil) && ((x)->fld[0].rtint) < 64) + || ((((x)->fld[0].rtint)) == 30 || (((x)->fld[0].rtint)) == 30 + || (((x)->fld[0].rtint)) == 31 || (((x)->fld[0].rtint)) == 0 + || ((((x)->fld[0].rtint)) >= (64) + && (((x)->fld[0].rtint)) <= (((64)) + 3)) + || ((((x)->fld[0].rtint)) < 64 && ((((x)->fld[0].rtint)) == 30 + || (((x)->fld[0].rtint)) == 30 || fixed_regs[((x)->fld[0].rtint)] + || global_regs[((x)->fld[0].rtint)]) + && ((((x)->fld[0].rtint)) + ? ((((x)->fld[0].rtint) < 32) + ? GENERAL_REGS : XRF_REGS) + : AP_REG) != NO_REGS))); + } +} + +/* { dg-final { scan-assembler "adrp\tx.*, fixed_regs\n\tadd\tx.*, x.*fixed_regs" } } */