vppinfra: clib_memcpy improvement 26/6326/1
authorRay Kinsella <ray.kinsella@intel.com>
Fri, 21 Apr 2017 10:08:43 +0000 (11:08 +0100)
committerRay Kinsella <ray.kinsella@intel.com>
Fri, 21 Apr 2017 10:26:39 +0000 (11:26 +0100)
In the case where n is a constant 16 bytes, the second load/store is
ignored by the load/store unit - it has neglible/zero cost. In the case
where  n is variable and greater than 512 bytes, the extra if (n == 16)
branch has a very small performance impact.

Change-Id: I04b313cf022c18fee31b1d9bcf6a128414659a99
Signed-off-by: Ray Kinsella <ray.kinsella@intel.com>
src/vppinfra/memcpy_avx.h
src/vppinfra/memcpy_sse3.h

index d95bbad..e3feb76 100644 (file)
@@ -185,11 +185,6 @@ clib_memcpy (void *dst, const void *src, size_t n)
        /**
          * Fast way when copy size doesn't exceed 512 bytes
          */
-  if (n == 16)
-    {
-      clib_mov16 ((u8 *) dst, (const u8 *) src);
-      return ret;
-    }
   if (n <= 32)
     {
       clib_mov16 ((u8 *) dst, (const u8 *) src);
index 49baf5e..4fc48c8 100644 (file)
@@ -224,11 +224,6 @@ clib_memcpy (void *dst, const void *src, size_t n)
        /**
         * Fast way when copy size doesn't exceed 512 bytes
         */
-  if (n == 16)
-    {
-      clib_mov16 ((u8 *) dst, (const u8 *) src);
-      return ret;
-    }
   if (n <= 32)
     {
       clib_mov16 ((u8 *) dst, (const u8 *) src);