llvm / llvm/llvm-project

clang-cl doesn't compile MSVC code using SIMD intrinsics

Open
#172,104 1 comment 0 reactions 0 assignees View on GitHub
clang-cl clang:headers diverges-from:msvc
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

For example:

```
#include

__m128i f(__m128i a, __m128i b) {
return _mm_mullo_epi32(a, b); // SSE4.1 intrinsic
}
```

This builds using Microsoft's `cl`.

However, with `clang-cl`, we get: `error: use of undeclared identifier '_mm_mullo_epi32'; did you mean '_mm_mullo_epi16'?`

We can specify `/arch:AVX` to solve the problem. However, this means that the compiler is then free to use AVX instructions, which is not what we want if we want to only target SSE4.1. MSVC does not appear to have a `/arch:SSE4.1` option: https://learn.microsoft.com/en-us/cpp/build/reference/arch-x64?view=msvc-170.

We can specify `/clang:-msse4.1` to solve the problem, but this means that `clang-cl` is not a clean replacement of `cl`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.