diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-12-22 19:52:48 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-08 17:32:00 +0200 |
commit | 83ba0d56f878409d3f758549c72e5d099cc71a07 (patch) | |
tree | d3b17493020d68682987d953a61cf5774464fc80 /tests/auto | |
parent | 526c851902c9b2762179bb338a21e025e7f471ac (diff) |
Add an SSE4.2 even simpler version of toLatin1
Use the new PCMPESTRM instruction (Parallel CoMPare Explicit-length
STRings with result in a Mask) which is added in SSE4.2 for
facilitating string operations. The "compare ranges" mode allows us to
search for characters outside the Latin 1 range and then use the
SSE4.1 PBLENDVB instruction to replace those with question marks.
Unlike previous SSE compare instructions, the PCMPxSTRx family allows
us to operate on unsigned 16-bit values. This saves us another
parallel add.
Reviewed-By: Samuel Rødal
(cherry picked from commit 45d2d36c9dbcbce403c78838ea52acd1ab111b68)
Change-Id: I0f9d864f9d19c0f0da43ccb6918dc28295074496
Reviewed-on: http://codereview.qt-project.org/4468
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qstring/tst_qstring.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp index cf68bda31f..844624ab45 100644 --- a/tests/auto/qstring/tst_qstring.cpp +++ b/tests/auto/qstring/tst_qstring.cpp @@ -3462,6 +3462,10 @@ void tst_QString::toLatin1Roundtrip_data() static const ushort unicode6[] = { 0x180, 0x1ff, 0x8001, 0x8080, 0xfffc }; QTest::newRow("non-latin1b") << QByteArray("?????") << QString::fromUtf16(unicode6, 5) << questionmarks; + + static const ushort unicode7[] = { 'H', 'e', 'l', 'l', 'o', 0x100, 0x17f, 0x180, 0x8080, 0xfffc }; + static const ushort unicode7q[] = { 'H', 'e', 'l', 'l', 'o', '?', '?', '?', '?', '?' }; + QTest::newRow("mixed") << QByteArray("Hello?????") << QString::fromUtf16(unicode7, 10) << QString::fromUtf16(unicode7q, 10); } void tst_QString::toLatin1Roundtrip() |