Browse Source

mips: allow to disable prefetch support in memcpy/memset

There exist some problem with the new memcpy/memset functions
imported from GNU libc/newlib. If you have any problem
with the new MIPS optimized assembly try to disable
prefetching support.

Thanks to Rene Nielsen and Matthew Fortune analyzing the
problem so far.
Waldemar Brodkorb 8 years ago
parent
commit
557f663a8c
3 changed files with 9 additions and 2 deletions
  1. 7 0
      extra/Configs/Config.mips
  2. 1 1
      libc/string/mips/memcpy.S
  3. 1 1
      libc/string/mips/memset.S

+ 7 - 0
extra/Configs/Config.mips

@@ -31,3 +31,10 @@ config CONFIG_MIPS_N64_ABI
 	bool "N64 ABI"
 
 endchoice
+
+config UCLIBC_USE_MIPS_PREFETCH
+	bool "Use MIPS prefetch optimization for memcpy/memset"
+	default y
+	help
+	  You get better performance when you use Prefetch.
+	  https://gcc.gnu.org/projects/prefetch.html#mips

+ 1 - 1
libc/string/mips/memcpy.S

@@ -39,7 +39,7 @@
 
 #if (_MIPS_ISA == _MIPS_ISA_MIPS4) || (_MIPS_ISA == _MIPS_ISA_MIPS5) || \
     (_MIPS_ISA == _MIPS_ISA_MIPS32) || (_MIPS_ISA == _MIPS_ISA_MIPS64)
-# ifndef DISABLE_PREFETCH
+# ifdef __UCLIBC_USE_MIPS_PREFETCH__
 #  define USE_PREFETCH
 # endif
 #endif

+ 1 - 1
libc/string/mips/memset.S

@@ -37,7 +37,7 @@
    prefetching.  */
 
 #if (__mips == 4) || (__mips == 5) || (__mips == 32) || (__mips == 64)
-# ifndef DISABLE_PREFETCH
+# ifdef __UCLIBC_USE_MIPS_PREFETCH__
 #  define USE_PREFETCH
 # endif
 #endif