[committed] v850, default to bigger switch tables

Jeff Law law@redhat.com
Tue Jun 26 05:45:00 GMT 2018


So many many years ago when I first wrote the v850 port I included the
ability to have entries in switch jump tables be either 16 or 32 bits
wide.  With the default being 16 bits.

In retrospect that was a mistake.  The silent failures when the entries
overflow  is just too painful.  This patch changes the default to 32
bits.  So the tables themselves are considerably larger.  The dispatch
code itself is slightly more efficient as we don't have to deal with
sign extending the 16bit offset to 32bits.

Code with different switch table sizes can co-exist.  Someone who really
wanted those smaller tables can use -mno-big-switch to get the prior
behavior.

This fixes a few more testsuite failures.  Committed to the trunk.

Jeff
-------------- next part --------------
commit 9038d0f6e0a23e2dfeb27e9cad471e98ebc155da
Author: Jeff Law <law@redhat.com>
Date:   Mon Jun 25 23:44:30 2018 -0600

            * common/config/v850/v850-common.c (TARGET_DEFAULT_TARGET_FLAGS): Turn
            on -mbig-switch by default.

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b5f073de663..3b1bd94f818 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,8 @@
 2018-06-25  Jeff Law  <law@redhat.com>
 
+	* common/config/v850/v850-common.c (TARGET_DEFAULT_TARGET_FLAGS): Turn
+	on -mbig-switch by default.
+
 	* config/v850/predicates.md (const_float_1_operand): Fix match_code
 	test.
 	(const_float_0_operand): Remove unused predicate.
diff --git a/gcc/common/config/v850/v850-common.c b/gcc/common/config/v850/v850-common.c
index 6a93ff08d84..803bc169018 100644
--- a/gcc/common/config/v850/v850-common.c
+++ b/gcc/common/config/v850/v850-common.c
@@ -122,7 +122,8 @@ static const struct default_options v850_option_optimization_table[] =
   };
 
 #undef  TARGET_DEFAULT_TARGET_FLAGS
-#define TARGET_DEFAULT_TARGET_FLAGS (MASK_DEFAULT | MASK_APP_REGS)
+#define TARGET_DEFAULT_TARGET_FLAGS \
+  (MASK_DEFAULT | MASK_APP_REGS | MASK_BIG_SWITCH)
 #undef  TARGET_HANDLE_OPTION
 #define TARGET_HANDLE_OPTION v850_handle_option
 #undef  TARGET_OPTION_OPTIMIZATION_TABLE


More information about the Gcc-patches mailing list