2011-12-29 Dmitry Melnik <dm@ispras.ru>
gcc/
* config/arm/arm.h (MAX_CONDITIONAL_EXECUTE): New macro.
@@ -1990,6 +1990,15 @@ typedef struct
#define BRANCH_COST(speed_p, predictable_p) \
(current_tune->branch_cost (speed_p, predictable_p))
+/* One IT-block consists of 4 insns at maximum. If-conversion can eliminate
+ 2 branches for IFs with both THEN and ELSE branches, and 1 branch for
+ those with only THEN branch. If we don't want code size to grow, and just
+ allow trading branch insns for IT insns, we should limit number of converted
+ insns to 4 (and in ifcvt.c it will be doubled if there are 2 branches). */
+#define MAX_CONDITIONAL_EXECUTE \
+ ((TARGET_THUMB2) ? 4 : BRANCH_COST (optimize_function_for_speed_p (cfun), \
+ false) + 1)
+
/* Position Independent Code. */
/* We decide which register to use based on the compilation options and