[kde-freebsd] Fixing devel/qt4-corelib to build with clang
Dimitry Andric
dim at FreeBSD.org
Wed May 8 15:31:45 UTC 2013
On 2013-05-08 16:11, Raphael Kubo da Costa wrote:
> Dimitry Andric <dimitry at andric.com> writes:
>> And it does similar includes for other intrinsics. Note that it tests
>> both QT_HAVE_SSE3 (which is a configure-time feature), and __SSE3__,
>> which is defined by the compiler, if it supports SSE3 in the current
>> mode. That is, if you either pass -msse3 on the command line, or use a
>> -march= or -mcpu= setting which is high enough to support the SSE3
>> feature.
>
> Related question: do you know why versions of GCC which do support those
> CPU instructions work in i386/i486 without any additional flags?
The test stage of the configure script passes the appropriate compiler
flags (-msse, etc) when it compiles the test cases. However, it does
not *run* the test cases, it only looks at whether they compile and
link. If they do, it considers the feature supported by the compiler.
> This whole issue got me really curious, and after installing a Debian
> i386 virtual machine to build a file which just includes
> <mm3dnow.h>. Both GCC 4.6 and 4.7 build it fine regardless of the values
> I pass to -march (or if I don't pass any value at all), whereas clang 3.0
> works by default but fails with those errors you mentioned if I pass
> -march={i386,i486,etc}.
This is because gcc's mm3dnow.h header has:
#ifndef _MM3DNOW_H_INCLUDED
#define _MM3DNOW_H_INCLUDED
#ifdef __3dNOW__
#include <mmintrin.h>
[...3DNow stuff...]
#endif /* __3dNOW_A__ */
#endif /* __3dNOW__ */
#endif /* _MM3DNOW_H_INCLUDED */
so it will only do anything if 3DNow is enabled. This is not consistent
with some other gcc intrinsics headers, for example xmmintrin.h, which
has:
#ifndef _XMMINTRIN_H_INCLUDED
#define _XMMINTRIN_H_INCLUDED
#ifndef __SSE__
# error "SSE instruction set not enabled"
#else
[...SSE stuff...]
#endif /* __SSE__ */
#endif /* _XMMINTRIN_H_INCLUDED */
E.g. if you compile this file without enabling SSE, it will result in an
error.
-Dimitry
More information about the kde-freebsd
mailing list