diff mbox

[alpha] : Enable flag_ree, fix PR 27468

Message ID CAFULd4YKg7pws+iS_tgj-he99L_TF1aWQQh9yFg+B4EHmQ621g@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Dec. 22, 2011, 10:11 a.m. UTC
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  <ubizjak@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.

Comments

Joseph Myers Dec. 22, 2011, 12:58 p.m. UTC | #1
On Thu, 22 Dec 2011, Uros Bizjak wrote:

> 2011-12-22  Uros Bizjak  <ubizjak@gmail.com>
> 
> 	PR target/27468
> 	* config/alpha/alpha.c (alpha_option_override): Enable flag_ree
> 	at -O2 or higher.

Is there a reason you are doing it this way rather than by adding an entry 
to alpha_option_optimization_table (in 
common/config/alpha/alpha-common.c), which would generally be the 
preferred way of enabling an option at certain optimization levels on a 
target-specific basis?
Uros Bizjak Dec. 22, 2011, 1:28 p.m. UTC | #2
On Thu, Dec 22, 2011 at 1:58 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:

>> 2011-12-22  Uros Bizjak  <ubizjak@gmail.com>
>>
>>       PR target/27468
>>       * config/alpha/alpha.c (alpha_option_override): Enable flag_ree
>>       at -O2 or higher.
>
> Is there a reason you are doing it this way rather than by adding an entry
> to alpha_option_optimization_table (in
> common/config/alpha/alpha-common.c), which would generally be the
> preferred way of enabling an option at certain optimization levels on a
> target-specific basis?

In fact, no. I was not aware of this approach, that is all.

Uros.
diff mbox

Patch

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;