[all-commits] [llvm/llvm-project] afec08: [clang] Add `intrin0.h` header to mimic `intrin0.h...
Max Winkler via All-commits
all-commits at lists.llvm.org
Tue Mar 19 05:31:17 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: afec08ef9f1015ea3fe8d67b92acfbb7837c6e9f
https://github.com/llvm/llvm-project/commit/afec08ef9f1015ea3fe8d67b92acfbb7837c6e9f
Author: Max Winkler <max.enrico.winkler at gmail.com>
Date: 2024-03-19 (Tue, 19 Mar 2024)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/lib/Headers/CMakeLists.txt
M clang/lib/Headers/bmiintrin.h
M clang/lib/Headers/immintrin.h
M clang/lib/Headers/intrin.h
A clang/lib/Headers/intrin0.h
M clang/lib/Headers/keylockerintrin.h
M clang/lib/Headers/x86gprintrin.h
M clang/lib/Headers/x86intrin.h
A clang/lib/Headers/yvals_core.h
Log Message:
-----------
[clang] Add `intrin0.h` header to mimic `intrin0.h` used by MSVC STL for clang-cl (#75711)
Fixes https://github.com/llvm/llvm-project/issues/53520.
#### Description ####
Provide `intrin0.h` to be the minimal set of intrinsics that the MSVC
STL requires.
The `intrin0.h` header matches the latest header provided by MSVC 1939
which does include some extra intrinsics that the MSVC STL does not use.
Inside `BuiltinHeaders.def` I kept the header description as `intrin.h`.
If you want me to change those to `intrin0.h` for the moved intrinsics
let me know.
This should now allow `immintrin.h` to be used with function targets for
runtime cpu detection of simd instruction sets without worrying about
the compile-time overhead from MSVC STL including `intrin.h` on clang.
I still need to figure out how to best update MSVC STL to detect for the
presence of `intrin0.h` from clang and to use this header over
`intrin.h`.
#### Testing ####
Built clang locally and ran the test suite. I still need to do a pass
over the existing unit tests for the ms intrinsics to make sure there
aren't any gaps. Wanted to get this PR up for discussion first.
Modified latest MSVC STL from github to point to `intrin0.h` for clang.
Wrote some test files that included MSVC STL headers that rely on
intrinsics such as `atomic`, `bit` and `vector`. Built the unit tests
against x86, arm, aarch64, and x64.
#### Benchmarks ####
The following include times are based on the x64 target with the
modified headers in this PR.
These timings were done by using `clang-cl.exe -ftime-trace` and taking
the wall time for parsing `intrin.h` and `intrin0.h`.
`intrin.h` takes ~897ms to parse.
`intrin0.h` takes ~1ms to parse.
If there is anything required or a different approach is preferred let
me know. I would very much like to move this over the finish line so we
can use function targets with clang-cl.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list