aboutsummaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorBernd Schmidt <bernd.schmidt@codesourcery.com>2010-03-19 18:41:22 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2010-03-19 18:41:22 +0000
commitc99102b8b4cc0ec725c741b13c6f406bbd924c73 (patch)
tree2bcf096e2c7a2d0589b6d0f349bfdd7ccaef90f5 /gcc/optabs.c
parent002b2dee5d23dff9cc0a7f3196838534bc084da4 (diff)
downloadgcc-c99102b8b4cc0ec725c741b13c6f406bbd924c73.zip
gcc-c99102b8b4cc0ec725c741b13c6f406bbd924c73.tar.gz
gcc-c99102b8b4cc0ec725c741b13c6f406bbd924c73.tar.bz2
re PR target/40697 (inefficient code to extract least bits from an integer value)
gcc/ PR target/40697 * optabs.c (avoid_expensive_constant): Use rtx_cost to find out the cost of loading the constant rather than assuming COSTS_N_INSNS (1). * config/arm/arm.c (thumb1_rtx_costs) <case CONST_INT>: If the outer code is AND, do the same tests as the andsi3 expander and return COSTS_N_INSNS (1) if and is cheap. testsuite/ PR target/40697 * gcc.target/arm/thumb-andsi.c: New test. From-SVN: r157582
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 747166b..a82619e 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -1389,11 +1389,11 @@ static rtx
avoid_expensive_constant (enum machine_mode mode, optab binoptab,
rtx x, bool unsignedp)
{
+ bool speed = optimize_insn_for_speed_p ();
if (mode != VOIDmode
&& optimize
&& CONSTANT_P (x)
- && rtx_cost (x, binoptab->code, optimize_insn_for_speed_p ())
- > COSTS_N_INSNS (1))
+ && rtx_cost (x, binoptab->code, speed) > rtx_cost (x, SET, speed))
{
if (CONST_INT_P (x))
{