diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2011-03-18 17:02:08 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2011-03-22 14:51:53 (GMT) |
commit | 152f40fa41bae551dffd7b0ed72ed2008d7ff642 (patch) | |
tree | 17c567dcf476489fef0ea1465f959feddfa9f604 /tests/benchmarks/corelib | |
parent | aa7543e735c5c0fe61049c432b264ad1f2cfd598 (diff) | |
download | Qt-152f40fa41bae551dffd7b0ed72ed2008d7ff642.zip Qt-152f40fa41bae551dffd7b0ed72ed2008d7ff642.tar.gz Qt-152f40fa41bae551dffd7b0ed72ed2008d7ff642.tar.bz2 |
Add an SSE4 version using PMOVZXBW and PSRLDQ
Diffstat (limited to 'tests/benchmarks/corelib')
-rw-r--r-- | tests/benchmarks/corelib/tools/qstring/main.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/benchmarks/corelib/tools/qstring/main.cpp b/tests/benchmarks/corelib/tools/qstring/main.cpp index c365e5a..4e73f14 100644 --- a/tests/benchmarks/corelib/tools/qstring/main.cpp +++ b/tests/benchmarks/corelib/tools/qstring/main.cpp @@ -1618,6 +1618,27 @@ void fromLatin1_sse2_withprolog(ushort *dst, const char *str, int size) fromLatin1_epilog(dst, str, size); } +void fromLatin1_sse4_pmovzxbw(ushort *dst, const char *str, int size) +{ + while (size >= 16) { + __m128i chunk = _mm_loadu_si128((__m128i*)str); // load + + // unpack the first 8 bytes, padding with zeros + const __m128i firstHalf = _mm_cvtepu8_epi16(chunk); + _mm_storeu_si128((__m128i*)dst, firstHalf); // store + + // unpack the last 8 bytes, padding with zeros + chunk = _mm_srli_si128(chunk, 8); + const __m128i secondHalf = _mm_cvtepu8_epi16(chunk); + _mm_storeu_si128((__m128i*)(dst + 8), secondHalf); // store + + str += 16; + dst += 16; + size -= 16; + } + fromLatin1_epilog(dst, str, size); +} + void fromLatin1_prolog_sse4_overcommit(ushort *dst, const char *str, int) { // load 8 bytes and zero-extend them to 16 @@ -1636,6 +1657,7 @@ void tst_QString::fromLatin1Alternatives_data() const QTest::newRow("sse2-with-prolog-unrolled") << &fromLatin1_sse2_withprolog<&fromLatin1_prolog_unrolled>; QTest::newRow("sse2-with-prolog-sse2-overcommit") << &fromLatin1_sse2_withprolog<&fromLatin1_prolog_sse2_overcommit>; QTest::newRow("sse2-with-prolog-sse4-overcommit") << &fromLatin1_sse2_withprolog<&fromLatin1_prolog_sse4_overcommit>; + QTest::newRow("sse4-pmovzxbw") << &fromLatin1_sse4_pmovzxbw; } extern StringData fromLatin1Data; |