Add an SSE4.2 even simpler version of toLatin1
authorThiago Macieira <thiago.macieira@nokia.com>
Wed, 22 Dec 2010 18:52:48 +0000 (19:52 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 8 Sep 2011 15:32:00 +0000 (17:32 +0200)
commit83ba0d56f878409d3f758549c72e5d099cc71a07
treed3b17493020d68682987d953a61cf5774464fc80
parent526c851902c9b2762179bb338a21e025e7f471ac
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>
src/corelib/tools/qstring.cpp
tests/auto/qstring/tst_qstring.cpp