aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>2014-04-15 14:04:06 +0000
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>2014-04-15 14:04:06 +0000
commit98a2fdfba6290cc34485d77edfd0a092871ae7fc (patch)
tree652dc50b2c332768e18edd452496d53671bc6ed6
parent9ffc6d0bc2a2c50047ef25871e290f75a45bd231 (diff)
downloadgcc-98a2fdfba6290cc34485d77edfd0a092871ae7fc.zip
gcc-98a2fdfba6290cc34485d77edfd0a092871ae7fc.tar.gz
gcc-98a2fdfba6290cc34485d77edfd0a092871ae7fc.tar.bz2
re PR rtl-optimization/60663 (Errors out on valid inline asm)
PR rtl-optimization/60663 * config/arm/arm.c (arm_new_rtx_costs): Improve ASM_OPERANDS case, avoid 0 cost. From-SVN: r209419
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/arm/arm.c12
2 files changed, 15 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6402544..cd6adc4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-04-15 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR rtl-optimization/60663
+ * config/arm/arm.c (arm_new_rtx_costs): Improve ASM_OPERANDS case,
+ avoid 0 cost.
+
2014-04-15 Richard Biener <rguenther@suse.de>
* lto-streamer.h (LTO_major_version): Bump to 4.
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index e5cf503..773c353 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));