summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-06-24 13:31:04 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-06-24 13:31:04 (GMT)
commit1281617cd15b51f08db392a04387f583197c4cd9 (patch)
tree3f89e82669b12ea49e0586d3ff14c0d01594301e /src/corelib/tools
parent181f86f118f5a53abf43bce37758b331b0aabe9a (diff)
parentf6310e6148180d651e95bff482ded47272e38718 (diff)
downloadQt-1281617cd15b51f08db392a04387f583197c4cd9.zip
Qt-1281617cd15b51f08db392a04387f583197c4cd9.tar.gz
Qt-1281617cd15b51f08db392a04387f583197c4cd9.tar.bz2
Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qt-doc-team
* 'master' of git://scm.dev.nokia.troll.no/qt/qt-doc-team: (63 commits) my changelog for 4.8.0 Add a function that returns the D-Bus local machine ID Add an SSE4.2 even simpler version of toLatin1 Skip boundry neutral characters in bidi itemization symbian socket engine: resolve some fixme and todo items trivial: fix typo in comment Fix QDeclarativeInspector when starting with ,block changelog docu update for QNX 6.5 get rid of anacronysm massive improvements for the QNX screen driver massive improvements for the QNX mouse driver massive improvements for the QNX keyboard driver disable the Embedded Linux data directory permissions check for QNX skip two subtests that are known to fail on QNX implement POSIX IPC based QLock, QWSLock and QWSSharedMemory backends implement POSIX IPC based QSystemSemaphore and QSharedMemory backends add a configure-time check for an IPC support make QProcess really work on QNX make the kernel attempt to emulate an instruction with a misaligned access ...
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qstring.cpp23
-rw-r--r--src/corelib/tools/qstring.h1
2 files changed, 24 insertions, 0 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index f8f4bdc..ee45cfd 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -3580,6 +3580,28 @@ static inline __m128i mergeQuestionMarks(__m128i chunk)
{
const __m128i questionMark = _mm_set1_epi16('?');
+# ifdef __SSE4_2__
+ // compare the unsigned shorts for the range 0x0100-0xFFFF
+ // note on the use of _mm_cmpestrm:
+ // The MSDN documentation online (http://technet.microsoft.com/en-us/library/bb514080.aspx)
+ // says for range search the following:
+ // For each character c in a, determine whether b0 <= c <= b1 or b2 <= c <= b3
+ //
+ // However, all examples on the Internet, including from Intel
+ // (see http://software.intel.com/en-us/articles/xml-parsing-accelerator-with-intel-streaming-simd-extensions-4-intel-sse4/)
+ // put the range to be searched first
+ //
+ // Disassembly and instruction-level debugging with GCC and ICC show
+ // that they are doing the right thing. Inverting the arguments in the
+ // instruction does cause a bunch of test failures.
+
+ const int mode = _SIDD_UWORD_OPS | _SIDD_CMP_RANGES | _SIDD_UNIT_MASK;
+ const __m128i rangeMatch = _mm_cvtsi32_si128(0xffff0100);
+ const __m128i offLimitMask = _mm_cmpestrm(rangeMatch, 2, chunk, 8, mode);
+
+ // replace the non-Latin 1 characters in the chunk with question marks
+ chunk = _mm_blendv_epi8(chunk, questionMark, offLimitMask);
+# else
// SSE has no compare instruction for unsigned comparison.
// The variables must be shiffted + 0x8000 to be compared
const __m128i signedBitOffset = _mm_set1_epi16(0x8000);
@@ -3603,6 +3625,7 @@ static inline __m128i mergeQuestionMarks(__m128i chunk)
// merge offLimitQuestionMark and correctBytes to have the result
chunk = _mm_or_si128(correctBytes, offLimitQuestionMark);
# endif
+# endif
return chunk;
}
#endif
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index c61d09e..bf0a0ad 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -639,6 +639,7 @@ private:
static Data *fromAscii_helper(const char *str, int size = -1);
void replace_helper(uint *indices, int nIndices, int blen, const QChar *after, int alen);
friend class QCharRef;
+ friend class QCFString;
friend class QTextCodec;
friend class QStringRef;
friend struct QAbstractConcatenable;