[Development] Enabling SSE2 by default on x86 builds (32-bit)

Thiago Macieira thiago.macieira at intel.com
Tue Dec 10 19:34:41 CET 2013

On terça-feira, 10 de dezembro de 2013 12:01:24, Rex Dieter wrote:
> So, for this to be workable, we'd need a canonical list of libraries that
> want/need SSE2 optimizations.

Right now, there's code in QtCore and QtGui that does SSE2-specific 
optimisations. I'd recommend it also for any libraries that do heavy floating 
point work (QtQml and especially QtQuick), since we're also adding the 
-mfpmath=sse option.

> While on the topic, and looking at qtdeclarative's JIT on i686,
> https://bugreports.qt-project.org/browse/QTBUG-35430
> would a similar workaround suffice for libQt5Qml?  build a normal sse2/jit
> enabled version and stuff into LIBDIR/sse2 dir, and a non-sse2/jit into

There's no JIT  without SSE2[*] . Your options are SSE JIT or no JIT only.

The question is whether the support for JIT or no JIT is present in the 
library. Let's see...

qv8engine.cpp, added in 4662e632e4f92b335483b91cd1f3576d6d82146f:

#ifdef Q_PROCESSOR_X86_32
    if (!(qCpuFeatures() & SSE2)) {
        qFatal("This program requires an X86 processor that supports SSE2 
extension, at least a Pentium 4 or newer");

Well, that answers it. Right now, the interpreted version is not compiled into 
the i486 binaries.

It can probably be fixed in qv4global_p.h:

#if defined(Q_PROCESSOR_X86)
#define V4_ENABLE_JIT
#elif defined(Q_PROCESSOR_X86_64)
#define V4_ENABLE_JIT

We can change that to:

#if defined(__SSE2__)
#define V4_ENABLE_JIT

[*] note that it's technically SSE support; SSE2 added the integer operations 
to SSE, which isn't what QtQuick needs. However, I removed the ability to 
check for SSE without SSE2 in Qt 5.0 and I bet that Erik, Simon and Lars 
didn't pay attention to which instructions they were using either.
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20131210/3f9b6764/attachment.sig>

More information about the Development mailing list