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

Simon Hausmann simon.hausmann at digia.com
Wed Dec 11 10:21:59 CET 2013


On Wednesday 11. December 2013 10.12.22 Knoll Lars wrote:
> On 11/12/13 10:03, "Simon Hausmann" <simon.hausmann at digia.com> wrote:
> >On Wednesday 11. December 2013 09.36.46 Simon Hausmann wrote:
> >[...]
> >
> >> > If we apply the change I mentioned in the other email, we change
> >>
> >>cases 2
> >>
> >> > and 3:
> >> > 
> >> > 2bis) distro builds Qt once with -no-sse2 flags
> >> > 
> >> > 	=> all libs compiled without SSE2
> >> > 	=> QtQml generates interpreted code only
> >> > 
> >> > 3bis) distro builds Qt once with -no-sse2 and then some libs with
> >>
> >>-config
> >>
> >> > sse2 => most libs compiled without SSE2, a few with SSE2 code
> >> > 
> >> > 	=> the non-SSE2 QtQml will generate interpreted code, the SSE2 one
> >>
> >>will
> >>
> >> > 	generate SSE2 code and will be used only in machines less than 14
> >>
> >>years
> >>
> >> > 	old
> >> 
> >> Yep, let's do that. It's relatively painless to support this kind of
> >>
> >>build
> >>
> >> configuration in QtQml at least.
> >
> >To puts words where my mouth is, here's a proposed fix for QtQml:
> >	https://codereview.qt-project.org/#change,73710
> 
> Is this the right fix for 5.2? I'm a bit afraid that this would cause
> Linux distributions to install the sse disabled QtQml by default, leading
> to pretty bad performance.

Good question...
 
> The other option for 5.2 would be to do runtime detection of SSE2 and
> enable/disable the JIT according to that.

I think the main issue with run-time detection is that we need -msse2
-mfpmath=sse in order to get reliable math results (no 80-bit temps) that 
match with our test expectations, when using the interpreter or non-inline 
math functions.

We could of course do that only with CONFIG(developer-build) or so, but it's a 
bit scary then that the interpreter in release builds would use a different 
precision than during development, and it might cause confusion in bug 
reports.

> PS: Actually I think QtQml in 5.0 and 5.1 was also requiring SSE (because
> of V8).

>From a quick glance at the V8 sources and a bit of google searching, it 
appears that V8's ia32 code generator supports SSE2 through run-time checks 
and falls back to run-time function calls otherwise. For example:

https://codereview.chromium.org/7324026/patch/1/2


Simon



More information about the Development mailing list