arm.c (arm_option_override): Set max_insns_skipped to MAX_INSN_PER_IT_BLOCK when...
authorZhenqiang Chen <zhenqiang.chen@arm.com>
Thu, 14 Aug 2014 04:47:43 +0000 (04:47 +0000)
committerZhenqiang Chen <zqchen@gcc.gnu.org>
Thu, 14 Aug 2014 04:47:43 +0000 (04:47 +0000)
ChangeLog:
2014-08-14  Zhenqiang Chen  <zhenqiang.chen@arm.com>

* config/arm/arm.c (arm_option_override): Set max_insns_skipped
to MAX_INSN_PER_IT_BLOCK when optimize_size for THUMB2.

testsuite/ChangeLog:
2014-08-14  Zhenqiang Chen  <zhenqiang.chen@arm.com>

* gcc.target/arm/max-insns-skipped.c: New test.

From-SVN: r213939

gcc/ChangeLog
gcc/config/arm/arm.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/max-insns-skipped.c [new file with mode: 0644]

index e58c7e1..50b38fb 100644 (file)
@@ -1,3 +1,8 @@
+2014-08-14  Zhenqiang Chen  <zhenqiang.chen@arm.com>
+
+       * config/arm/arm.c (arm_option_override): Set max_insns_skipped
+       to MAX_INSN_PER_IT_BLOCK when optimize_size for THUMB2.
+
 2014-08-13  Chen Gang  gang.chen.5i5j@gmail.com
 
        * microblaze/microblaze.md: Remove redundant '@' to avoid compiling
index 7f62ca4..2f8d327 100644 (file)
@@ -2989,6 +2989,10 @@ arm_option_override (void)
       /* If optimizing for size, bump the number of instructions that we
          are prepared to conditionally execute (even on a StrongARM).  */
       max_insns_skipped = 6;
+
+      /* For THUMB2, we limit the conditional sequence to one IT block.  */
+      if (TARGET_THUMB2)
+       max_insns_skipped = MAX_INSN_PER_IT_BLOCK;
     }
   else
     max_insns_skipped = current_tune->max_insns_skipped;
index e122b50..ad9cce2 100644 (file)
@@ -1,3 +1,7 @@
+2014-08-14  Zhenqiang Chen  <zhenqiang.chen@arm.com>
+
+       * gcc.target/arm/max-insns-skipped.c: New test.
+
 2014-08-14  Bin Cheng  <bin.cheng@arm.com>
 
        * c-c++-common/addrtmp.c: Add bind_pic_locally option.
diff --git a/gcc/testsuite/gcc.target/arm/max-insns-skipped.c b/gcc/testsuite/gcc.target/arm/max-insns-skipped.c
new file mode 100644 (file)
index 0000000..0a11554
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do assemble { target arm_thumb2 } } */
+/* { dg-options " -Os " } */
+
+int t (int a, int b, int c, int d)
+{
+  int r;
+  if (a > 0) {
+    r = a + b;
+    r += 0x456;
+    r *= 0x1234567;
+    }
+  else {
+    r = b - a;
+    r -= 0x123;
+    r *= 0x12387;
+    r += d;
+   }
+  return r;
+}
+
+/* { dg-final { object-size text <= 40 } } */