[cfe-dev] LLVM error with SSE4.1 intrinsics and LTO

Christopher Kulla ckulla at gmail.com
Wed Jul 9 10:21:41 PDT 2014


Hi all,

I posted this to llvm-dev but didn't get any response, I'm re-trying
here in case it is related to the clang driver somehow.

The following program does not link correctly when using LTO:

"clang -flto -msse4.1 test.c"

#include <smmintrin.h>

int main() {
    __m128i a = _mm_set1_epi32(2);
    __m128i b = _mm_set1_epi32(1);
    __m128i c = _mm_min_epi32(a, b); // or _mm_max_epi32
    return c[0] == 0; // just so c doesn't opt away
}

It works fine without "-flto".

I've reproduced this using 3.4.2 as well as 3.5 (from trunk) on both
Linux and OS X.

Am I missing some flags to tell the linker to enable sse4.1? Or is
there a bug here?

Any pointers are appreciated! Thank you!

-Chris



More information about the cfe-dev mailing list