Patch for MIPS memcpy
Mon Feb 11 23:38:00 GMT 2013
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:
_MIPS_ISA == _MIPS_ISA_MIPS4
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?
2013-02-11 Steve Ellcey <email@example.com>
* 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
@@ -49,8 +49,11 @@
-#if (_MIPS_ISA == _MIPS_ISA_MIPS4) || (_MIPS_ISA == _MIPS_ISA_MIPS5) || \
- (_MIPS_ISA == _MIPS_ISA_MIPS32) || (_MIPS_ISA == _MIPS_ISA_MIPS64)
+/* Check to see if the MIPS architecture we are compiling for supports
+ * prefetching.
+#if (__mips == 4) || (__mips == 5) || (__mips == 32) || (__mips == 64)
More information about the Newlib