summaryrefslogtreecommitdiff
path: root/gcc/config/mcore/mcore.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/mcore/mcore.c')
-rw-r--r--gcc/config/mcore/mcore.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c
index 97fbb8c8768..69fa798b666 100644
--- a/gcc/config/mcore/mcore.c
+++ b/gcc/config/mcore/mcore.c
@@ -144,6 +144,7 @@ static void mcore_option_override (void);
static bool mcore_legitimate_constant_p (machine_mode, rtx);
static bool mcore_legitimate_address_p (machine_mode, rtx, bool,
addr_space_t);
+static bool mcore_hard_regno_mode_ok (unsigned int, machine_mode);
/* MCore specific attributes. */
@@ -240,6 +241,9 @@ static const struct attribute_spec mcore_attribute_table[] =
#undef TARGET_WARN_FUNC_RETURN
#define TARGET_WARN_FUNC_RETURN mcore_warn_func_return
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK mcore_hard_regno_mode_ok
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Adjust the stack and return the number of bytes taken to do it. */
@@ -3260,3 +3264,14 @@ mcore_legitimate_address_p (machine_mode mode, rtx x, bool strict_p,
return false;
}
+/* Implement TARGET_HARD_REGNO_MODE_OK. We may keep double values in
+ even registers. */
+
+static bool
+mcore_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+ if (TARGET_8ALIGN && GET_MODE_SIZE (mode) > UNITS_PER_WORD)
+ return (regno & 1) == 0;
+
+ return regno < 18;
+}