This is the mail archive of the mailing list for the newlib project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch for MIPS memcpy

My new MIPS memcpy is supposed to check the architecture it is being compiled
for and only use prefetching if it is on a MIPS architecture that supports
it.  That check is bad because it was checking for something like:


The problem is that on MIPS1, _MIPS_ISA is defined by GCC as _MIPS_ISA_MIPS1
but _MIPS_ISA_MIPS1 is not defined by GCC.  Likewise _MIPS_ISA_MIPS4 is not
defined by GCC, so the above check returns true on a MIPS1 architecture.

This patch fixes the problem by replacing the use of _MIPS_ISA with
__mips which is defined by GCC to be 1, 2, 3, 4, 32, or 64, depending
on what architecture it is compiling for.  

Tested by building for mips-elf (mips1 architecture).  OK for checkin?

Steve Ellcey (

2013-02-11  Steve Ellcey  <>

	* libc/machine/mips/memcpy.S: Fix USE_PREFETCH check.

diff --git a/newlib/libc/machine/mips/memcpy.S b/newlib/libc/machine/mips/memcpy.S
index 574f549..16ae6d1 100644
--- a/newlib/libc/machine/mips/memcpy.S
+++ b/newlib/libc/machine/mips/memcpy.S
@@ -49,8 +49,11 @@
 #include <sys/asm.h>
-#if (_MIPS_ISA == _MIPS_ISA_MIPS4) || (_MIPS_ISA == _MIPS_ISA_MIPS5) || \
+/* Check to see if the MIPS architecture we are compiling for supports
+ * prefetching.
+ */
+#if (__mips == 4) || (__mips == 5) || (__mips == 32) || (__mips == 64)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]