@@ -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;
b/gcc/testsuite/gcc.target/arm/max-insns-skipped.c
new file mode 100644
@@ -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 } } */