From: Kyrylo Tkachov Date: Thu, 11 Jun 2015 10:01:11 +0000 (+0000) Subject: [ARM] Restrict MAX_CONDITIONAL_EXECUTE when -mrestrict-it is in place X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=06b8f7acf3786fafb54e402ebdf794e7ee3caa3e;p=gcc.git [ARM] Restrict MAX_CONDITIONAL_EXECUTE when -mrestrict-it is in place * config/arm/arm.c (arm_option_params_internal): When optimising for speed set max_insns_skipped when arm_restrict_it. * gcc.target/arm/short-it-ifcvt-1.c: New test. * gcc.target/arm/short-it-ifcvt-2.c: Likewise. From-SVN: r224367 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f89cbb6c9d2..409171ca2f4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-06-11 Kyrylo Tkachov + + * config/arm/arm.c (arm_option_params_internal): When optimising + for speed set max_insns_skipped when arm_restrict_it. + 2015-06-11 Christian Bruel PR target/52144 diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 353c2c599d9..5744f955f20 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -2788,7 +2788,10 @@ arm_option_params_internal (struct gcc_options *opts) max_insns_skipped = opts->x_arm_restrict_it ? 1 : 4; } else - max_insns_skipped = current_tune->max_insns_skipped; + /* When -mrestrict-it is in use tone down the if-conversion. */ + max_insns_skipped + = (TARGET_THUMB2_P (opts->x_target_flags) && opts->x_arm_restrict_it) + ? 1 : current_tune->max_insns_skipped; } /* Options after initial target override. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0accb7c3d71..cf2c0d6cc06 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-06-11 Kyrylo Tkachov + + * gcc.target/arm/short-it-ifcvt-1.c: New test. + * gcc.target/arm/short-it-ifcvt-2.c: Likewise. + 2015-06-11 Christian Bruel PR target/52144 diff --git a/gcc/testsuite/gcc.target/arm/short-it-ifcvt-1.c b/gcc/testsuite/gcc.target/arm/short-it-ifcvt-1.c new file mode 100644 index 00000000000..f3d29b7d234 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/short-it-ifcvt-1.c @@ -0,0 +1,23 @@ +/* Test that ifcvt is not being too aggressive when -mrestrict-it. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mrestrict-it" } */ +/* { dg-require-effective-target arm_thumb2_ok } */ + +int +f1(int x, int y, int z) +{ + if (x > 100) + { + x++; + z = -z; + } + else + { + x = -x; + y = -y; + z = 1; + } + return x + y + z; +} + +/* { dg-final { scan-assembler "b(gt|le)" } } */ diff --git a/gcc/testsuite/gcc.target/arm/short-it-ifcvt-2.c b/gcc/testsuite/gcc.target/arm/short-it-ifcvt-2.c new file mode 100644 index 00000000000..9ac8153069f --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/short-it-ifcvt-2.c @@ -0,0 +1,21 @@ +/* Test that ifcvt is not being too aggressive when -mrestrict-it. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mrestrict-it" } */ +/* { dg-require-effective-target arm_thumb2_ok } */ + +int +f1(int x, int y, int z) +{ + if (x > 100) + { + x++; + z = -z; + } + else + { + x = -x; + y = -y; + } + return x + y + z; +} +/* { dg-final { scan-assembler "b(gt|le)" } } */