[backport r171978 from gcc-4.7/trunk, PR43920 patch 4/n ] gcc/ 2011-04-05 Tom de Vries PR target/43920 * config/arm/arm.h (BRANCH_COST): Set to 1 for Thumb-2 when optimizing for size. --- gcc-4.6.0/gcc/config/arm/arm.h.~1~ 2011-01-29 04:20:57.000000000 +0100 +++ gcc-4.6.0/gcc/config/arm/arm.h 2011-06-19 22:21:43.000000000 +0200 @@ -2039,7 +2039,8 @@ typedef struct /* Try to generate sequences that don't involve branches, we can then use conditional instructions */ #define BRANCH_COST(speed_p, predictable_p) \ - (TARGET_32BIT ? 4 : (optimize > 0 ? 2 : 0)) + (TARGET_32BIT ? (TARGET_THUMB2 && !speed_p ? 1 : 4) \ + : (optimize > 0 ? 2 : 0)) /* Position Independent Code. */ /* We decide which register to use based on the compilation options and