diff options
author | Bernd Schmidt <bernds@redhat.com> | 2017-01-23 16:17:33 +0000 |
---|---|---|
committer | Bernd Schmidt <bernds@gcc.gnu.org> | 2017-01-23 16:17:33 +0000 |
commit | e9c4fbe9c1eff61ffe2aa31c67cef2ffd346f674 (patch) | |
tree | 7bf4e542d8044a3f0fe9963033e40db0f94ed55e /gcc | |
parent | 8539a302cdc56a76a797a18a83d5d68d9cd9f94a (diff) | |
download | gcc-e9c4fbe9c1eff61ffe2aa31c67cef2ffd346f674.zip gcc-e9c4fbe9c1eff61ffe2aa31c67cef2ffd346f674.tar.gz gcc-e9c4fbe9c1eff61ffe2aa31c67cef2ffd346f674.tar.bz2 |
re PR rtl-optimization/78634 (30% performance drop after r242832.)
PR rtl-optimization/78634
* config/i386/i386.c (ix86_max_noce_ifcvt_seq_cost): New function.
(TARGET_MAX_NOCE_IFCVT_SEQ_COST): Define.
* ifcvt.c (noce_try_cmove): Add missing cost check.
testsuite/
PR rtl-optimization/78634
* gcc.target/i386/funcspec-11.c: Also pass -mtune=i686.
From-SVN: r244816
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 24 | ||||
-rw-r--r-- | gcc/ifcvt.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/funcspec-11.c | 2 |
5 files changed, 38 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bd71649..35694c2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-01-23 Bernd Schmidt <bschmidt@redhat.com> + + PR rtl-optimization/78634 + * config/i386/i386.c (ix86_max_noce_ifcvt_seq_cost): New function. + (TARGET_MAX_NOCE_IFCVT_SEQ_COST): Define. + * ifcvt.c (noce_try_cmove): Add missing cost check. + 2017-01-23 Bin Cheng <bin.cheng@arm.com> PR tree-optimization/70754 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 65b32e6..15498a9 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -50486,6 +50486,28 @@ ix86_spill_class (reg_class_t rclass, machine_mode mode) return NO_REGS; } +/* Implement TARGET_MAX_NOCE_IFCVT_SEQ_COST. Like the default implementation, + but returns a lower bound. */ + +static unsigned int +ix86_max_noce_ifcvt_seq_cost (edge e) +{ + bool predictable_p = predictable_edge_p (e); + + enum compiler_param param + = (predictable_p + ? PARAM_MAX_RTL_IF_CONVERSION_PREDICTABLE_COST + : PARAM_MAX_RTL_IF_CONVERSION_UNPREDICTABLE_COST); + + /* If we have a parameter set, use that, otherwise take a guess using + BRANCH_COST. */ + if (global_options_set.x_param_values[param]) + return PARAM_VALUE (param); + else + return BRANCH_COST (true, predictable_p) * COSTS_N_INSNS (2); +} + + /* Implement targetm.vectorize.init_cost. */ static void * @@ -52035,6 +52057,8 @@ ix86_run_selftests (void) #undef TARGET_EXPAND_DIVMOD_LIBFUNC #define TARGET_EXPAND_DIVMOD_LIBFUNC ix86_expand_divmod_libfunc +#undef TARGET_MAX_NOCE_IFCVT_SEQ_COST +#define TARGET_MAX_NOCE_IFCVT_SEQ_COST ix86_max_noce_ifcvt_seq_cost #if CHECKING_P #undef TARGET_RUN_TARGET_SELFTESTS #define TARGET_RUN_TARGET_SELFTESTS selftest::ix86_run_selftests diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 6d30639..e2d6c6f 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -1826,7 +1826,7 @@ noce_try_cmove (struct noce_if_info *if_info) noce_emit_move_insn (if_info->x, target); seq = end_ifcvt_sequence (if_info); - if (!seq) + if (!seq || !noce_conversion_profitable_p (seq, if_info)) return FALSE; emit_insn_before_setloc (seq, if_info->jump, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index de1f24b..5bdeda8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-01-23 Bernd Schmidt <bschmidt@redhat.com> + + PR rtl-optimization/78634 + * gcc.target/i386/funcspec-11.c: Also pass -mtune=i686. + 2017-01-23 Bin Cheng <bin.cheng@arm.com> PR tree-optimization/70754 diff --git a/gcc/testsuite/gcc.target/i386/funcspec-11.c b/gcc/testsuite/gcc.target/i386/funcspec-11.c index 7c39f4c..fc79ac5 100644 --- a/gcc/testsuite/gcc.target/i386/funcspec-11.c +++ b/gcc/testsuite/gcc.target/i386/funcspec-11.c @@ -1,7 +1,7 @@ /* PR target/36936 */ /* { dg-do compile } */ /* { dg-require-effective-target ia32 } */ -/* { dg-options "-O2 -march=i386" } */ +/* { dg-options "-O2 -march=i386 -mtune=i686" } */ /* { dg-final { scan-assembler "cmov" } } */ extern int foo (int) __attribute__((__target__("arch=i686"))); |