diff mbox

[SPARC] Enable REE at -O2 by default in 64-bit mode

Message ID 2089802.4AkFIGpqyi@polaris
State New
Headers show

Commit Message

Eric Botcazou Nov. 24, 2016, 3:30 p.m. UTC
Tests showed that it helps to eliminates redundant 32-to-64-bit extensions.

Tested on SPARC/Solaris, applied on the mainline.


2016-11-24  Eric Botcazou  <ebotcazou@adacore.com>

	* common/config/sparc/sparc-common.c (option_optimization_table):
	Enable REE at -O2 and higher.
	* config/sparc/sparc.c (sparc_option_override): Disable it by default
	in 32-bit mode.

-- 
Eric Botcazou

Comments

Jeff Law Nov. 24, 2016, 3:36 p.m. UTC | #1
On 11/24/2016 08:30 AM, Eric Botcazou wrote:
> Tests showed that it helps to eliminates redundant 32-to-64-bit extensions.

>

> Tested on SPARC/Solaris, applied on the mainline.

>

>

> 2016-11-24  Eric Botcazou  <ebotcazou@adacore.com>

>

> 	* common/config/sparc/sparc-common.c (option_optimization_table):

> 	Enable REE at -O2 and higher.

> 	* config/sparc/sparc.c (sparc_option_override): Disable it by default

> 	in 32-bit mode.

Very cool.  Ideally all targets would enable REE, but we're obviously 
not there yet.

With the fixes you've just done it's probably a lot more feasible to 
experiment with REE on other risc targets.

jeff
Eric Botcazou Nov. 24, 2016, 4:06 p.m. UTC | #2
> With the fixes you've just done it's probably a lot more feasible to

> experiment with REE on other risc targets.


I didn't experiment much, but I saw no effects at all in 32-bit mode, only in 
64-bit mode.  That being said, SPARC is one of the very few RISC targets that 
do _not_ define PROMOTE_MODE, this could be an explanation.

-- 
Eric Botcazou
diff mbox

Patch

Index: common/config/sparc/sparc-common.c
===================================================================
--- common/config/sparc/sparc-common.c	(revision 242632)
+++ common/config/sparc/sparc-common.c	(working copy)
@@ -28,6 +28,8 @@  along with GCC; see the file COPYING3.
 static const struct default_options sparc_option_optimization_table[] =
   {
     { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 },
+    /* Enable redundant extension instructions removal at -O2 and higher.  */
+    { OPT_LEVELS_2_PLUS, OPT_free, NULL, 1 },
     { OPT_LEVELS_NONE, 0, NULL, 0 }
   };
 
Index: config/sparc/sparc.c
===================================================================
--- config/sparc/sparc.c	(revision 242632)
+++ config/sparc/sparc.c	(working copy)
@@ -1713,6 +1713,11 @@  sparc_option_override (void)
      pessimizes for double floating-point registers.  */
   if (!global_options_set.x_flag_ira_share_save_slots)
     flag_ira_share_save_slots = 0;
+
+  /* Only enable REE by default in 64-bit mode where it helps to eliminate
+     redundant 32-to-64-bit extensions.  */
+  if (!global_options_set.x_flag_ree && TARGET_ARCH32)
+    flag_ree = 0;
 }
 
 /* Miscellaneous utilities.  */