+2015-07-28 Nick Clifton <nickc@redhat.com>
+
+ * config/rl78/rl78.c (rl78_addsi3_internal): New function.
+ Optimizes the case where -mes0 is active and a constant symbolic
+ address is used.
+ * config/rl78/rl78-protos.h: Prototype the new function.
+ * config/rl78/rl78.md (addsi3_internal_real): Call new function.
+
2015-07-28 Tom de Vries <tom@codesourcery.com>
* tree-parloops.c (reduc_stmt_res): New function.
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
\f
+const char * rl78_addsi3_internal (rtx *, unsigned int);
void rl78_emit_eh_epilogue (rtx);
void rl78_expand_compare (rtx *);
void rl78_expand_movsi (rtx *);
if (TARGET_ES0
&& strcmp (lang_hooks.name, "GNU C")
+ && strcmp (lang_hooks.name, "GNU C11")
+ && strcmp (lang_hooks.name, "GNU C89")
+ && strcmp (lang_hooks.name, "GNU C99")
/* Compiling with -flto results in a language of GNU GIMPLE being used... */
&& strcmp (lang_hooks.name, "GNU GIMPLE"))
/* Address spaces are currently only supported by C. */
return res;
}
+
+const char *
+rl78_addsi3_internal (rtx * operands, unsigned int alternative)
+{
+ /* If we are adding in a constant symbolic address when -mes0
+ is active then we know that the address must be <64K and
+ that it is invalid to access anything above 64K relative to
+ this address. So we can skip adding in the high bytes. */
+ if (TARGET_ES0
+ && GET_CODE (operands[2]) == SYMBOL_REF
+ && TREE_CODE (SYMBOL_REF_DECL (operands[2])) == VAR_DECL
+ && TREE_READONLY (SYMBOL_REF_DECL (operands[2]))
+ && ! TREE_SIDE_EFFECTS (SYMBOL_REF_DECL (operands[2])))
+ return "movw ax, %h1\n\taddw ax, %h2\n\tmovw %h0, ax";
+
+ switch (alternative)
+ {
+ case 0:
+ case 1:
+ return "movw ax, %h1\n\taddw ax, %h2\n\tmovw %h0, ax\n\tmovw ax, %H1\n\tsknc\n\tincw ax\n\taddw ax, %H2\n\tmovw %H0, ax";
+ case 2:
+ return "movw ax, %h1\n\taddw ax,%h2\n\tmovw bc, ax\n\tmovw ax, %H1\n\tsknc\n\tincw ax\n\taddw ax, %H2\n\tmovw %H0, ax\n\tmovw ax, bc\n\tmovw %h0, ax";
+ default:
+ gcc_unreachable ();
+ }
+}
+
\f
#undef TARGET_PREFERRED_RELOAD_CLASS
#define TARGET_PREFERRED_RELOAD_CLASS rl78_preferred_reload_class
(clobber (reg:HI BC_REG))
]
"rl78_real_insns_ok ()"
- "@
- movw ax,%h1 \;addw ax,%h2 \;movw %h0, ax \;movw ax,%H1 \;sknc \;incw ax \;addw ax,%H2 \;movw %H0,ax
- movw ax,%h1 \;addw ax,%h2 \;movw %h0, ax \;movw ax,%H1 \;sknc \;incw ax \;addw ax,%H2 \;movw %H0,ax
- movw ax,%h1 \;addw ax,%h2 \;movw bc, ax \;movw ax,%H1 \;sknc \;incw ax \;addw ax,%H2 \;movw %H0,ax \;movw ax,bc \;movw %h0, ax"
+ { return rl78_addsi3_internal (operands, which_alternative); }
[(set_attr "valloc" "macax")]
)