summaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorYuri Rumyantsev <ysrumyan@gmail.com>2016-01-11 12:07:31 +0000
committerIlya Enkovich <ienkovich@gcc.gnu.org>2016-01-11 12:07:31 +0000
commitca90b1ed9ac7e9aaacb3ef0eb055d2f594d30493 (patch)
treeaff7cf99fbd76cee5e9f06139145d6518bc63045 /gcc/config
parentb4934671aed067e0a8c3ac3fcc5871dd27a706ed (diff)
downloadgcc-ca90b1ed9ac7e9aaacb3ef0eb055d2f594d30493.tar.gz
re PR rtl-optimization/68920 (Undesirable if-conversion for a rarely taken branch)
gcc/ 2016-01-11 Yuri Rumyantsev <ysrumyan@gmail.com> PR rtl-optimization/68920 * config/i386/i386.c (ix86_option_override_internal): Restrict number of conditional moves for RTL if-conversion to 1 for TARGET_ONE_IF_CONV_INSN. * config/i386/i386.h (TARGET_ONE_IF_CONV_INSN): New macros. * config/i386/x86-tune.def (X86_TUNE_ONE_IF_CONV_INSN): New macros. * params.def (PARAM_MAX_RTL_IF_CONVERSION_INSNS) : Introduce new parameter to restirct number of conditional moves for RTL if-conversion. * doc/invoke.texi (max-rtl-if-conversion-insns): Document it. * ifcvt.c (bb_ok_for_noce_convert_multiple_sets): Limit number of conditionl moves. gcc/testsuite/ 2016-01-11 Yuri Rumyantsev <ysrumyan@gmail.com> PR rtl-optimization/68920 * gcc.dg/ifcvt-4.c: Add "--param max-rtl-if-conversion-insns=3" option for ix86 targets. * gcc.dg/ifcvt-5.c: New test. From-SVN: r232220
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/i386/i386.c7
-rw-r--r--gcc/config/i386/i386.h2
-rw-r--r--gcc/config/i386/x86-tune.def5
3 files changed, 14 insertions, 0 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index aac0847db7e..c0b2cce4f3f 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -5343,6 +5343,13 @@ ix86_option_override_internal (bool main_args_p,
opts->x_param_values,
opts_set->x_param_values);
+ /* Restrict number of if-converted SET insns to 1. */
+ if (TARGET_ONE_IF_CONV_INSN)
+ maybe_set_param_value (PARAM_MAX_RTL_IF_CONVERSION_INSNS,
+ 1,
+ opts->x_param_values,
+ opts_set->x_param_values);
+
/* Enable sw prefetching at -O3 for CPUS that prefetching is helpful. */
if (opts->x_flag_prefetch_loop_arrays < 0
&& HAVE_prefetch
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index befed85721c..dcaa011a2be 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -499,6 +499,8 @@ extern unsigned char ix86_tune_features[X86_TUNE_LAST];
ix86_tune_features[X86_TUNE_ADJUST_UNROLL]
#define TARGET_AVOID_FALSE_DEP_FOR_BMI \
ix86_tune_features[X86_TUNE_AVOID_FALSE_DEP_FOR_BMI]
+#define TARGET_ONE_IF_CONV_INSN \
+ ix86_tune_features[X86_TUNE_ONE_IF_CONV_INSN]
/* Feature tests against the various architecture variations. */
enum ix86_arch_indices {
diff --git a/gcc/config/i386/x86-tune.def b/gcc/config/i386/x86-tune.def
index 88ed50aa860..9d25e51d407 100644
--- a/gcc/config/i386/x86-tune.def
+++ b/gcc/config/i386/x86-tune.def
@@ -550,3 +550,8 @@ DEF_TUNE (X86_TUNE_PROMOTE_QI_REGS, "promote_qi_regs", 0)
unrolling small loop less important. For, such architectures we adjust
the unroll factor so that the unrolled loop fits the loop buffer. */
DEF_TUNE (X86_TUNE_ADJUST_UNROLL, "adjust_unroll_factor", m_BDVER3 | m_BDVER4)
+
+/* X86_TUNE_ONE_IF_CONV_INSNS: Restrict a number of set insns to be
+ if-converted to one. */
+DEF_TUNE (X86_TUNE_ONE_IF_CONV_INSN, "one_if_conv_insn",
+ m_SILVERMONT | m_KNL | m_INTEL | m_CORE_ALL | m_GENERIC)