Title: [133100] trunk/Source/WTF
Revision
133100
Author
[email protected]
Date
2012-10-31 17:31:14 -0700 (Wed, 31 Oct 2012)

Log Message

Add an optimized version of copyLCharsFromUCharSource for ARM
https://bugs.webkit.org/show_bug.cgi?id=94886

Patch by Benjamin Poulain <[email protected]> on 2012-10-31
Reviewed by Gavin Barraclough.

Michael Saboff added a SIMD version of copyLCharsFromUCharSource() in r125846.

This patch a similar optimization for ARMv7 by using the interleaved load/store available
in the NEON extension.

The performance gains:
-10000 characters: ~3.5 times faster.
-20 characters (2 vectors): ~55% faster.
-15 characters (1 vector): ~21% faster.
-3 characters (no vector, pure overhead): ~10% slower.

* wtf/text/ASCIIFastPath.h:
(WTF::copyLCharsFromUCharSource):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (133099 => 133100)


--- trunk/Source/WTF/ChangeLog	2012-11-01 00:09:54 UTC (rev 133099)
+++ trunk/Source/WTF/ChangeLog	2012-11-01 00:31:14 UTC (rev 133100)
@@ -1,3 +1,24 @@
+2012-10-31  Benjamin Poulain  <[email protected]>
+
+        Add an optimized version of copyLCharsFromUCharSource for ARM
+        https://bugs.webkit.org/show_bug.cgi?id=94886
+
+        Reviewed by Gavin Barraclough.
+
+        Michael Saboff added a SIMD version of copyLCharsFromUCharSource() in r125846.
+
+        This patch a similar optimization for ARMv7 by using the interleaved load/store available
+        in the NEON extension.
+
+        The performance gains:
+        -10000 characters: ~3.5 times faster.
+        -20 characters (2 vectors): ~55% faster.
+        -15 characters (1 vector): ~21% faster.
+        -3 characters (no vector, pure overhead): ~10% slower.
+
+        * wtf/text/ASCIIFastPath.h:
+        (WTF::copyLCharsFromUCharSource):
+
 2012-10-31  Christophe Dumez  <[email protected]>
 
         [EFL][WK2][AC] Use smart pointers for Evas_GL types

Modified: trunk/Source/WTF/wtf/text/ASCIIFastPath.h (133099 => 133100)


--- trunk/Source/WTF/wtf/text/ASCIIFastPath.h	2012-11-01 00:09:54 UTC (rev 133099)
+++ trunk/Source/WTF/wtf/text/ASCIIFastPath.h	2012-11-01 00:31:14 UTC (rev 133100)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
  * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
  *
  * This library is free software; you can redistribute it and/or
@@ -131,6 +131,31 @@
         ASSERT(!(source[i] & 0xff00));
         destination[i] = static_cast<LChar>(source[i]);
     }
+#elif COMPILER(GCC) && CPU(ARM_NEON) && !(PLATFORM(BIG_ENDIAN) || PLATFORM(MIDDLE_ENDIAN)) && defined(NDEBUG)
+    const LChar* const end = destination + length;
+    const uintptr_t memoryAccessSize = 8;
+
+    if (length >= (2 * memoryAccessSize) - 1) {
+        // Prefix: align dst on 64 bits.
+        const uintptr_t memoryAccessMask = memoryAccessSize - 1;
+        do {
+            *destination++ = static_cast<LChar>(*source++);
+        } while (!isAlignedTo<memoryAccessMask>(destination));
+
+        // Vector interleaved unpack, we only store the lower 8 bits.
+        const uintptr_t lengthLeft = end - destination;
+        const LChar* const simdEnd = end - (lengthLeft % memoryAccessSize);
+        do {
+            asm("vld2.8   { d0-d1 }, [%[SOURCE]] !\n\t"
+                "vst1.8   { d0 }, [%[DESTINATION],:64] !\n\t"
+                : [SOURCE]"+r" (source), [DESTINATION]"+r" (destination)
+                :
+                : "memory", "d0", "d1");
+        } while (destination != simdEnd);
+    }
+
+    while (destination != end)
+        *destination++ = static_cast<LChar>(*source++);
 #else
     for (size_t i = 0; i < length; ++i) {
         ASSERT(!(source[i] & 0xff00));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to