From 5d5ae25097d273b7acfb6058639398ee3d769e4d Mon Sep 17 00:00:00 2001 From: yroux Date: Thu, 12 Jun 2014 09:13:57 +0000 Subject: [PATCH] 2014-05-23 Yvan Roux Backport from trunk r209419. 2014-04-15 Kyrylo Tkachov PR rtl-optimization/60663 * config/arm/arm.c (arm_new_rtx_costs): Improve ASM_OPERANDS case, avoid 0 cost. git-svn-id: svn://gcc.gnu.org/svn/gcc/branches/linaro/gcc-4_9-branch@211497 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.linaro | 9 +++++++++ gcc/config/arm/arm.c | 12 +++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog.linaro b/gcc/ChangeLog.linaro index 485b4ea..3c73070 100644 --- a/gcc/ChangeLog.linaro +++ b/gcc/ChangeLog.linaro @@ -1,5 +1,14 @@ 2014-05-23 Yvan Roux + Backport from trunk r209419. + 2014-04-15 Kyrylo Tkachov + + PR rtl-optimization/60663 + * config/arm/arm.c (arm_new_rtx_costs): Improve ASM_OPERANDS case, + avoid 0 cost. + +2014-05-23 Yvan Roux + Backport from trunk r209457. 2014-04-16 Andrew Pinski diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index fbd029b..55eda1d 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -10670,10 +10670,16 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code, return true; case ASM_OPERANDS: - /* Just a guess. Cost one insn per input. */ - *cost = COSTS_N_INSNS (ASM_OPERANDS_INPUT_LENGTH (x)); - return true; + { + /* Just a guess. Guess number of instructions in the asm + plus one insn per input. Always a minimum of COSTS_N_INSNS (1) + though (see PR60663). */ + int asm_length = MAX (1, asm_str_count (ASM_OPERANDS_TEMPLATE (x))); + int num_operands = ASM_OPERANDS_INPUT_LENGTH (x); + *cost = COSTS_N_INSNS (asm_length + num_operands); + return true; + } default: if (mode != VOIDmode) *cost = COSTS_N_INSNS (ARM_NUM_REGS (mode)); -- 2.7.4