[clang] [clang] Add `intrin0.h` header to mimic `intrin0.h` used by MSVC STL for clang-cl (PR #75711)

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 18 11:29:34 PST 2023


rnk wrote:

> If we land this as-is, it'll tank build time on Windows.

While this is true, I don't think it's the right tradeoff for us to leave Intel intrinsics inaccessible for users who don't want to enable new microarchitectural features globally with command line flags. You may recall there are ODR issues, where enabling AVX globally results in AVX instructions being generated in inline functions, which then prevail at link time, and crash at runtime on chips where AVX is not available. We are currently prioritizing compile time above those needs, and that doesn't seem like the right tradeoff.

What I'd like to see is a pull request sent to https://github.com/microsoft/stl with some agreement about how to structure the ifdefs so we can use intrin0.h when it is available. We probably can't use `__has_include(<intrin0.h>)` because MSVC ships its own copy of intrin0.h, and they can't be distinguished. Perhaps we should come up with our own name for `intrin0.h`, so we can feature-detect it. I suggest `intrin_msstl.h` or `intrin_minimal.h` or something.

Then, when we land this PR, the net effect is that compile time with MSVC slows down until the next release of the Microsoft STL, but users have access to Intel intrinsics as soon as possible. Does that seem reasonable?

https://github.com/llvm/llvm-project/pull/75711


More information about the cfe-commits mailing list