[Interest] building Qt 4.8.7 with gcc 5 and link-time optimisation on Linux

Thiago Macieira thiago.macieira at intel.com
Fri Jul 24 23:27:45 CEST 2015


On Friday 24 July 2015 21:17:24 René J. V. Bertin wrote:
> Thiago Macieira wrote:
> > For Clang, QT_COMPILER_SUPPORTS_HERE(x) expands to a check defined(__x__)
> > [in this case, if __SSE4_2__ is defined].
> 
> I had a hunch it'd be that, but must have missed the actual macro definition
> where this would have become evident (I was working remotely, so only used
> vi to browse the code).

__SSE4_2__ isn't defined anywhere you'll see. It's pre-defined by the compiler.

	clang -dM -E -xc /dev/null | sort

> > Ah, that is actually the issue.
> 
> I'm actually a bit surprised that either the compiler finds nothing in the
> Qt code to auto-vectorise with SSE4 instructions, or that that doesn't lead
> to issues in the linker with LTO.

The latter. As I said, my guess is this is a compiler bug because it obviously 
has SSE4.2 enabled.

Search your regular code for SSE4.1 instructions (like PBLENDVB, 
PMINxx/PMAXxx, PINSRx, PEXTRx, PMOVZXx) and you'll find them. 

Note that GCC only auto-vectorises on -O3. I don't know about Clang.

> > You're on OS X. All 64-bit Mac hardware supports SSE 4.2, so that feature
> > is always enabled when compiling 64-bit code. The -no-sse4.2 option has
> > no effect on 64-bit, the same way that the -no-ssse3 option has no effect
> > in 32-bit code.
> 
> I find that a bit curious. Why disallow the user to deactivate support for
> SSEx (and why not even printing a message drawing attention to the fact)?

Because it can't be disabled in the compiler. It *always* generates those 
instructions.

> Fortunately your claim isn't true to the extent that the feature is enabled
> also when SSE4 support is not enabled at the level of the compiler.

That's incorrect. SSE4.2 is enabled in your compiler because you're using 
Apple's build of Clang.

> Also, note that code that has to run on VMs may need to deactivate SSE4
> support. There is at least 1 virtualisation solution that does not expose
> the instruction set.

No VM will ever do that and run OS X code.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list