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

Thiago Macieira thiago.macieira at intel.com
Sun Nov 10 14:28:07 CET 2013

On domingo, 10 de novembro de 2013 13:27:11, Christoph Feck wrote:
> > 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.

Actually, it does. The fact that the x87 stack computes intermediaries with 
higher precision is a source of problems. Sometimes, calculations yield 
different results depending on when a value was spilled from register to 

In particular, for the JS interpreter case, using SSE registers means we 
*always* use double precision, yielding proper IEEE 754 operations required by 
the ECMAScript standard. Using x87 would introduce errors.

> >  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?

The code was written to avoid that. I think the only code that reads beyond 
the end of the buffer is the SSSE3 one using PALIGNR. However, PALIGNR is used 
because we are doing two aligned loads. Aligned loads never cross page 

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/20131110/8bce0f36/attachment.sig>

More information about the Development mailing list