headers: Provide __cpuidex for Clang 17

In 2b6c924761, we changed so that
we don't provide __cpuidex for Clang 17 or newer, as Clang itself
provided that as a builtin.

The __cpuidex builtin was added in Clang during the course of
development of Clang 17, but it was reverted before version 17 was
released (it was added initially in
2df77ac20a1ed996706b164b0c4ed5ad140f635f, in llvm-project, on May 24th,
but later reverted in f3baf63d9a1ba91974f4df6abb8f2abd9a0df5b5 on August
4th, which also was cherrypicked to the 17.x release branch).

Clang 17 isn't formally released yet, but it has been agreed to
not reland the change within the 17.x release series - in
https://reviews.llvm.org/D157115#4561681.

In current git main of llvm-project, the __cpuidex builtin isn't
yet readded, but it is being planned and it seems likely to
be readded before version 18 gets released in 6 months; thus
bump the version to 18 instead of removing the condition entirely.
Relanding it is being discussed in https://reviews.llvm.org/D158348.

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Martin Storsjö 2023-09-11 14:19:28 +03:00
parent 1906d341c2
commit 0605217f5d

View File

@ -2023,7 +2023,7 @@ void __cpuid(int CPUInfo[4], int InfoType) {
#define __INTRINSIC_DEFINED___cpuid
#endif /* __INTRINSIC_PROLOG */
#if (!defined(__GNUC__) || __GNUC__ < 11) && (!defined(__clang__) || __clang_major__ < 17)
#if (!defined(__GNUC__) || __GNUC__ < 11) && (!defined(__clang__) || __clang_major__ < 18)
#if __INTRINSIC_PROLOG(__cpuidex)
void __cpuidex(int CPUInfo[4], int, int);
#if !__has_builtin(__cpuidex)