The following seems to help, particularly with -fno-common; however, does it cause performance regression for other code?
Index: common/config/epiphany/epiphany-common.c
===================================================================
--- common/config/epiphany/epiphany-common.c (revision 205586)
+++ common/config/epiphany/epiphany-common.c (working copy)
@@ -39,6 +39,8 @@ #define TARGET_DEFAULT_TARGET_FLAGS \
static const struct default_options epiphany_option_optimization_table[] =
{
{ OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 },
+ /* Enable section anchors by default at -O1 or higher. */
+ { OPT_LEVELS_1_PLUS, OPT_fsection_anchors, NULL, 1 },
{ OPT_LEVELS_NONE, 0, NULL, 0 }
};
Index: config/epiphany/epiphany.c
===================================================================
--- config/epiphany/epiphany.c (revision 205586)
+++ config/epiphany/epiphany.c (working copy)
@@ -145,6 +145,13 @@ #define TARGET_ASM_CAN_OUTPUT_MI_THUNK \
hook_bool_const_tree_hwi_hwi_const_tree_true
#define TARGET_ASM_OUTPUT_MI_THUNK epiphany_output_mi_thunk
+/* ??? we can use larger offsets for wider-mode sized accesses, but there
+ is no concept of anchors being dependent on the modes that they are used
+ for, so we can only use an offset range that would suit all modes. */
+#define TARGET_MAX_ANCHOR_OFFSET 2047
+/* We further restrict the minimum to be a multiple of eight. */
+#define TARGET_MIN_ANCHOR_OFFSET -2040
+
#include "target-def.h"
#undef TARGET_ASM_ALIGNED_HI_OP
@@ -763,6 +770,11 @@ epiphany_rtx_costs (rtx x, int code, int
*total = COSTS_N_INSNS (1);
return true;
+ case PLUS: case MINUS:
+ if (outer_code == SET)
+ *total = 0;
+ return false;
+
default:
return false;
}
@@ -2003,7 +2015,7 @@ #define REG_OK_FOR_BASE_P(X) \
&& LEGITIMATE_OFFSET_ADDRESS_P (mode, XEXP ((x), 1)))
return true;
if (mode == BLKmode)
- return true;
+ return epiphany_legitimate_address_p (SImode, x, strict);
return false;
}
Index: config/epiphany/epiphany.h
===================================================================
--- config/epiphany/epiphany.h (revision 205609)
+++ config/epiphany/epiphany.h (working copy)
@@ -942,4 +942,15 @@ extern rtl_opt_pass *make_pass_resolve_s
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
epiphany_start_function ((FILE), (NAME), (DECL))
+/* This is how we tell the assembler that two symbols have the same value. */
+#define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \
+ do \
+ { \
+ assemble_name (FILE, NAME1); \
+ fputs (" = ", FILE); \
+ assemble_name (FILE, NAME2); \
+ fputc ('\n', FILE); \
+ } \
+ while (0)
+
#endif /* !GCC_EPIPHANY_H */