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

Lisandro Damián Nicanor Pérez Meyer perezmeyer at gmail.com
Tue Dec 10 18:18:39 CET 2013

On Sunday 10 November 2013 16:19:03 Thiago Macieira wrote:
> This came up as an impromptu discussion during Dev Days.
> According to Lars and Simon, the new V4's JIT engine generates
> floating-point math for QML only using SSE registers on x86. That means the
> JIT code cannot run on CPUs that don't have SSE support. Those CPUs can
> only run the interpreted bytecode instead.
> Also, please consider that MS Visual Studio 2012 has switched to using SSE2
> instructions by default. The old behaviour can be obtained by passing the
> appropriate command-line arguments.
> Here's what we're proposing:
> 1) in the Linux 32-bit packages generated by the Qt Project, we switch to
> generating SSE2 code by default and also ask GCC to use that instead of x87
> for FPU operations (add to the command-line: -msse2 -mfpmath=sse).
> 2) remove the AVX-based drawhelpers and leave only the SSE2-based ones, with
> *no* runtime check. The SSSE3 improvements will still be runtime checked
> (they are only a handful of functions, which are easy to contain).
> Simultaneously, we'll apply the same change to the ARM Neon-based
> drawhelpers, which are giving us headaches: no runtime detection.
> 3) the default for source builds should be also the above. The original
> behaviour can be restored by passing -no-sse2 to configure. That will also
> disable the SSE2-based draw helpers completely. With MSVC, since the switch
> comes from the compiler, users need to modify their qmake.conf in addition
> to passing the extra option to configure.
> 4) this change to be implemented in 5.3.0.
> Additional benefits of this change are:
>  a) all FP math done in Qt will be done using SSE instead of the slower x87
> stack
>  b) the drawhelpers will be unconditionally enabled
>  c) the SSE2-based code for the Latin1 and UTF-8 codecs will be
> unconditionally enabled
> Impact:
> We honestly do not expect anyone who's actually building Qt 5 from sources
> to be targetting a CPU made prior to 2004 (with the exception of the 2013
> Intel Quark). There may be a few people who download from sources and try
> to run on CPUs older than Intel Pentium-M, Intel Pentium 4, AMD Opteron and
> Athlon 64. Those people will be forced to switch to a source build instead.

(this is part of a followup done by IRC, so I'll add some of that info here)

Well, it turns out that at least Debian (and Fedora, as I have been told 
today) is in that position for i386, with an enormous userbase, with a minimum 
as described in [0].

Thiago suggested building everything without sse2 and then some specific libs 
with it and install them alongside, which could be a reasonable option.

He also gave us some directions on how we could achieve this, feel free to 
ping me if you need them.

Saddly the only part missing will be the new V4's JIT engine. For that we will 
probably need to turn off the JIT.

I've also asked the Fedora guys to comment on this thread too.

[0] <http://popcon.debian.org/stat/submission.png> Of course, not everyone in 
there uses Qt, but the vast majority does. And that's only from people who 
enabled the popcon submission system.


Lisandro Damián Nicanor Pérez Meyer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20131210/60807884/attachment.sig>

More information about the Development mailing list