]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/60663 (Errors out on valid inline asm)
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>
Tue, 15 Apr 2014 14:04:06 +0000 (14:04 +0000)
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>
Tue, 15 Apr 2014 14:04:06 +0000 (14:04 +0000)
PR rtl-optimization/60663
* config/arm/arm.c (arm_new_rtx_costs): Improve ASM_OPERANDS case,
avoid 0 cost.

From-SVN: r209419

gcc/ChangeLog
gcc/config/arm/arm.c

index 64025445e8a2d4664216bbb25187ba102089f11d..cd6adc4efe6121c6dbd86664f7b1e41d007fdb23 100644 (file)
@@ -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.
index e5cf5036631dd27cbe8b5641a40c04c496314742..773c353ba0996cd4601aecf743f4b4306526ee9b 100644 (file)
@@ -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));