Hello! Attached patch enables flag_ree at -O2 and higher on alpha. Alpha has certain instructions with implicit SI->DI sign extension, and new REE pass can merge explicit sign conversions to them without problems.
For example, compiling combine.c with (+) and without (-) REE pass results in following changes: cmpeq $10,$9,$2 # 108 *setcc_internal [length = 4] bne $2,$L76 # 109 *bcc_normal [length = 4] ldl $2,0($9) # 121 *extendsidi2_1/2 [length = 4] - zapnot $2,3,$2 # 123 zero_extendhisi2/1 [length = 4] - addl $31,$2,$2 # 124 *extendsidi2_1/1 [length = 4] + zapnot $2,3,$2 # 123 zero_extendhidi2/1 [length = 4] s4addq $2,$11,$2 # 126 *saddq/1 [length = 4] ldl $2,0($2) # 127 *extendsidi2_1/2 [length = 4] zapnot $2,15,$2 # 128 zero_extendsidi2 [length = 4] and zapnot $1,15,$4 # 114 zero_extendsidi2 [length = 4] - addl $1,1,$1 # 119 addsi3/1 [length = 4] + addl $1,1,$1 # 119 *addsi_se/1 [length = 4] sll $4,6,$4 # 115 ashldi3/2 [length = 4] zapnot $1,15,$2 # 122 zero_extendsidi2 [length = 4] addq $6,$4,$4 # 116 *adddi_internal/1 [length = 4] cmpeq $2,$3,$2 # 124 *setcc_internal [length = 4] - cpys $f31,$f31,$f31 # 446 fnop [length = 4] stl $5,32($4) # 118 *movsi/6 [length = 4] - addl $31,$1,$1 # 120 *extendsidi2_1/1 [length = 4] beq $2,$L85 # 125 *bcc_normal [length = 4] br $31,$L80 # 438 jump [length = 4] There are quite some occurrences, showing that redundant extensions removal pass is effective on alpha. 2011-12-22 Uros Bizjak <ubiz...@gmail.com> PR target/27468 * config/alpha/alpha.c (alpha_option_override): Enable flag_ree at -O2 or higher. Patch was bootstrapped and regression tested on alphaev68-pc-linux-gnu. OK for mainline? Uros.
Index: alpha.c =================================================================== --- alpha.c (revision 182615) +++ alpha.c (working copy) @@ -412,6 +412,10 @@ alpha_option_override (void) alpha_memory_latency = lat; } + /* Enable redundant extension instructions removal at -O2 and higher. */ + if (optimize >= 2 && !global_options_set.x_flag_ree) + flag_ree = 1; + /* Default the definition of "small data" to 8 bytes. */ if (!global_options_set.x_g_switch_value) g_switch_value = 8;