summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-12-22 18:52:48 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2011-06-22 14:26:56 (GMT)
commit45d2d36c9dbcbce403c78838ea52acd1ab111b68 (patch)
tree76a0888856b6750e7869456c9a4f0984b9bc048f /tests
parentaf3bb0f146ec357ae6daf752a5f8bbdb074cde20 (diff)
downloadQt-45d2d36c9dbcbce403c78838ea52acd1ab111b68.zip
Qt-45d2d36c9dbcbce403c78838ea52acd1ab111b68.tar.gz
Qt-45d2d36c9dbcbce403c78838ea52acd1ab111b68.tar.bz2
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
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qstring/tst_qstring.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp
index c19b168..b26121c 100644
--- a/tests/auto/qstring/tst_qstring.cpp
+++ b/tests/auto/qstring/tst_qstring.cpp
@@ -3475,6 +3475,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()