summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qstring.cpp')
-rw-r--r--src/corelib/tools/qstring.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 9544062dd9..555f8a8c97 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -189,9 +189,23 @@ static int ucstricmp(const ushort *a, const ushort *ae, const uchar *b, const uc
return 1;
}
+#if defined(__mips_dsp)
+// From qstring_mips_dsp_asm.S
+extern "C" int qt_ucstrncmp_mips_dsp_asm(const ushort *a,
+ const ushort *b,
+ unsigned len);
+#endif
+
// Unicode case-sensitive compare two same-sized strings
static int ucstrncmp(const QChar *a, const QChar *b, int l)
{
+#if defined(__mips_dsp)
+ if (l >= 8) {
+ return qt_ucstrncmp_mips_dsp_asm(reinterpret_cast<const ushort*>(a),
+ reinterpret_cast<const ushort*>(b),
+ l);
+ }
+#endif // __mips_dsp
while (l-- && *a == *b)
a++,b++;
if (l==-1)
@@ -3947,6 +3961,10 @@ static inline __m128i mergeQuestionMarks(__m128i chunk)
}
#endif
+#if defined(__mips_dsp)
+extern "C" void qt_toLatin1_mips_dsp_asm(uchar *dst, const ushort *src, int length);
+#endif
+
static void toLatin1_helper(uchar *dst, const ushort *src, int length)
{
if (length) {
@@ -3995,10 +4013,14 @@ static void toLatin1_helper(uchar *dst, const ushort *src, int length)
length = length % 8;
}
#endif
+#if defined(__mips_dsp)
+ qt_toLatin1_mips_dsp_asm(dst, src, length);
+#else
while (length--) {
*dst++ = (*src>0xff) ? '?' : (uchar) *src;
++src;
}
+#endif
}
}
@@ -4151,6 +4173,12 @@ QVector<uint> QString::toUcs4() const
return v;
}
+#if defined(__mips_dsp)
+// From qstring_mips_dsp_asm.S
+extern "C" void qt_fromlatin1_mips_asm_unroll4 (ushort*, const char*, uint);
+extern "C" void qt_fromlatin1_mips_asm_unroll8 (ushort*, const char*, uint);
+#endif
+
QString::Data *QString::fromLatin1_helper(const char *str, int size)
{
Data *d;
@@ -4191,8 +4219,15 @@ QString::Data *QString::fromLatin1_helper(const char *str, int size)
size = size % 16;
}
#endif
+#if defined(__mips_dsp)
+ if (size > 20)
+ qt_fromlatin1_mips_asm_unroll8(dst, str, size);
+ else
+ qt_fromlatin1_mips_asm_unroll4(dst, str, size);
+#else
while (size--)
*dst++ = (uchar)*str++;
+#endif
}
return d;
}