This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] Performance fix for libmpx memmove wrapper


This patch was tested on spec2000, spec2006 and make check. It fixes
regression on vortex.


2015-12-11  Tsvetkova Alexandra  <aleksandra.tsvetkova@intel.com>

* libmpxwrap/mpx_wrappers.c (mpx_pointer): New type.


diff --git a/libmpx/mpxwrap/mpx_wrappers.c b/libmpx/mpxwrap/mpx_wrappers.c
old mode 100644
new mode 100755
index ffa7e7e..679e546
--- a/libmpx/mpxwrap/mpx_wrappers.c
+++ b/libmpx/mpxwrap/mpx_wrappers.c
@@ -483,10 +483,20 @@ __mpx_wrapper_memmove (void *dst, const void
*src, size_t n)
   __bnd_chk_ptr_bounds (dst, n);
   __bnd_chk_ptr_bounds (src, n);

+  /* This is an speedup for size of pointer.  */
+  if (n == sizeof (void *))
+  {
+    const void **s = (const void**)src;
+    void **d = (void**)dst;
+    *d = *s;
+ return dst;
+  }
+
   memmove (dst, src, n);
+
   /* Not necessary to copy bounds if size is less then size of pointer
      or SRC==DST.  */
-  if ((n >= sizeof (void *)) && (src != dst))
+  if ((n > sizeof (void *)) && (src != dst))
     move_bounds (dst, src, n);

   return dst;


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