openbsd-ports/lang/gcc/4.2/patches/patch-gcc_builtins_c
naddy ec58a1093d Merge in fixes for alpha from base (miod@):
builtins.c:
Allow MD backend to prevent the optimization of a bcopy() or memmove() of
size 1 (the size being known at compile-time) into an inline mempcpy()
expansion, which will in turn expand into a byte load and store operation.
This expansion loses precious address alignment information at some point
(because everybody knows that you can read a byte from any address, right?),
and this loses bigtime on strict alignment platforms which lack the ability
to accesse bytes directly, such as alpha (unless compiling with -mbwx and
runnning on a BWX-capable cpu).

config/alpha:
Require alignment of local arrays on word boundaries, and enable
the builtins.c `one-byte memcpy' workaround.

ok espie@
2011-12-03 15:54:05 +00:00

28 lines
820 B
Plaintext

$OpenBSD: patch-gcc_builtins_c,v 1.3 2011/12/03 15:54:05 naddy Exp $
--- gcc/builtins.c.orig Wed Feb 20 18:33:07 2008
+++ gcc/builtins.c Fri Dec 2 16:24:16 2011
@@ -3060,10 +3060,19 @@ expand_builtin_memmove (tree arglist, tree type, rtx t
it is ok to use memcpy as well. */
if (integer_onep (len))
{
- rtx ret = expand_builtin_mempcpy (arglist, type, target, mode,
- /*endp=*/0);
- if (ret)
- return ret;
+#if defined(SUBWORD_ACCESS_P)
+ if (SUBWORD_ACCESS_P
+ || (src_align >= BIGGEST_ALIGNMENT
+ && dest_align >= BIGGEST_ALIGNMENT))
+ {
+#endif
+ rtx ret = expand_builtin_mempcpy (arglist, type, target, mode,
+ /*endp=*/0);
+ if (ret)
+ return ret;
+#if defined(SUBWORD_ACCESS_P)
+ }
+#endif
}
/* Otherwise, call the normal function. */