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

Christoph Feck christoph at maxiom.de
Sun Nov 10 13:27:11 CET 2013

On Sunday 10 November 2013 08:19:03 Thiago Macieira wrote:
> [...]
> 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).
> [...]

From http://en.wikipedia.org/wiki/SSE3 :
"There is also a new instruction to convert floating point values to 
integers without having to change the global rounding mode, thus 
avoiding costly pipeline stalls."

According to http://www.taffysoft.com/pages/20120418-01.html the SSE3 
set is available on all CPUs since 2005, so I suggest to go for SSE3 
(not SSSE3) as the default.

> Additional benefits of this change are:
>  a) all FP math done in Qt will be done using SSE instead of the
> slower x87 stack

Note that x87 math has higher precision, because it computes with 80 
bits internally before rounding final results, but I doubt it has any 
impact on the computations that Qt does.

>  b) the drawhelpers will be unconditionally enabled
>  c) the SSE2-based code for the Latin1 and UTF-8 codecs will be
> unconditionally enabled

I have seen crashes ending in Qt SSE2 helper functions, probably 
because they access more data than needed due to the SIMD nature of 
the instructions. This can cause access violations on page boundaries. 
Has the Qt SSE2 code been audited for avoiding these?

Christoph Feck
KDE Quality Team

More information about the Development mailing list