[cfe-dev] clang-cl and intrinsics

Kim Gräsman via cfe-dev cfe-dev at lists.llvm.org
Sun Dec 13 21:42:31 PST 2015


Hi all,

I'm trying to use clang-cl on Windows to be able to use ASAN. The
build system I'm using is a little wonky, so I worked around it by
putting the Clang build output dir in the executable search path, and
creating a link from cl.exe -> clang-cl.exe there.

So far, so good -- clang-cl is compiling the code when I build from
Visual Studio.

But as soon as it hits an <ostream> include, I get build errors from
Clang's intrinsics headers, e.g.:

1>  In file included from C:\project\t.cpp:1:
1>  In file included from C:\project\t.h:5:
1>  In file included from C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\include\ostream:6:
1>  In file included from C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\include\ios:6:
1>  In file included from C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\include\xlocnum:10:
1>  In file included from C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\include\streambuf:6:
1>  In file included from C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\include\xiosbase:6:
1>  In file included from C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\include\xlocale:8:
1>  In file included from C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\include\stdexcept:7:
1>  In file included from C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\include\xstring:6:
1>  In file included from C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\include\xmemory0:942:
1>  In file included from
D:\dev\private\llvm-trunk\out\reldbg\bin\..\lib\clang\3.8.0\include\intrin.h:34:
1>  In file included from
D:\dev\private\llvm-trunk\out\reldbg\bin\..\lib\clang\3.8.0\include\x86intrin.h:29:
1>  In file included from
D:\dev\private\llvm-trunk\out\reldbg\bin\..\lib\clang\3.8.0\include\immintrin.h:31:
1>D:\dev\private\llvm-trunk\out\reldbg\bin\..\lib\clang\3.8.0\include\emmintrin.h(1484,3):
error : use of undeclared identifier '__builtin_ia32_pause'
1>    __builtin_ia32_pause();
1>    ^

1>  In file included from C:\project\t.cpp:1:
1>  In file included from C:\project\t.h:5:
1>  In file included from C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\include\ostream:6:
1>  In file included from C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\include\ios:6:
1>  In file included from C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\include\xlocnum:10:
1>  In file included from C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\include\streambuf:6:
1>  In file included from C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\include\xiosbase:6:
1>  In file included from C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\include\xlocale:8:
1>  In file included from C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\include\stdexcept:7:
1>  In file included from C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\include\xstring:6:
1>  In file included from C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\include\xmemory0:942:
1>  In file included from
D:\dev\private\llvm-trunk\out\reldbg\bin\..\lib\clang\3.8.0\include\intrin.h:34:
1>  In file included from
D:\dev\private\llvm-trunk\out\reldbg\bin\..\lib\clang\3.8.0\include\x86intrin.h:29:
1>  In file included from
D:\dev\private\llvm-trunk\out\reldbg\bin\..\lib\clang\3.8.0\include\immintrin.h:37:
1>D:\dev\private\llvm-trunk\out\reldbg\bin\..\lib\clang\3.8.0\include\smmintrin.h(146,45):
error : cannot initialize a parameter of type
'__attribute__((__vector_size__(2 * sizeof(long long)))) long long *'
with an rvalue of type 'const __v2di *'
1>    return (__m128i) __builtin_ia32_movntdqa ((const __v2di *) __V);
1>                                              ^~~~~~~~~~~~~~~~~~~~

Did I miss anything here? I'm not telling clang-cl anything about
target, I did try passing various /arch: arguments without any
success.

Thanks for any ideas!

- Kim


More information about the cfe-dev mailing list