This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
newlib/libc/machine/m68k/memcpy.S broken for cpu32
- From: Josef Wolf <jw at raven dot inka dot de>
- To: newlib at sourceware dot org
- Date: Mon, 8 Feb 2010 16:43:14 +0100
- Subject: newlib/libc/machine/m68k/memcpy.S broken for cpu32
Hello,
In newlib/libc/machine/m68k/memcpy.S, MISALIGNED_OK is set to 1 for
cpu32. This is wrong: cpu32 requires alignment to even addresses. Please
find patch attached.
While at it: Currently, memcpy() is only optimized for CPUs with 4-byte
alignment, even if the CPU could work well with 2-byte alignment. I think
such an optimization would give a great performance improvement on such
CPUs, since the probability to use the optimized code would rise from 1/16
to 1/2.
Opinions?
Here's the patch:
diff -ruw newlib-1.18.0.orig/newlib/libc/machine/m68k/memcpy.S newlib-1.18.0/newlib/libc/machine/m68k/memcpy.S
--- newlib-1.18.0.orig/newlib/libc/machine/m68k/memcpy.S 2010-02-08 15:23:22.719360886 +0100
+++ newlib-1.18.0/newlib/libc/machine/m68k/memcpy.S 2009-12-14 21:50:53.000000000 +0100
@@ -15,7 +15,7 @@
#include "m68kasm.h"
-#if defined (__mcoldfire__) || defined (__mc68010__) || defined (__mc68020__) || defined (__mc68030__) || defined (__mc68040__) || defined (__mc68060__)
+#if defined (__mcoldfire__) || defined (__mcpu32__) || defined (__mc68010__) || defined (__mc68020__) || defined (__mc68030__) || defined (__mc68040__) || defined (__mc68060__)
# define MISALIGNED_OK 1
#else
# define MISALIGNED_OK 0