[clang] 8b6f09e - Revert "[clang][X86] Add __cpuidex function to cpuid.h"
Aiden Grossman via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 19 17:18:39 PDT 2023
Author: Aiden Grossman
Date: 2023-08-19T17:18:10-07:00
New Revision: 8b6f09e257b521947b50761737290e5bf31c80f3
URL: https://github.com/llvm/llvm-project/commit/8b6f09e257b521947b50761737290e5bf31c80f3
DIFF: https://github.com/llvm/llvm-project/commit/8b6f09e257b521947b50761737290e5bf31c80f3.diff
LOG: Revert "[clang][X86] Add __cpuidex function to cpuid.h"
This reverts commit 58696d2f5bbae32dddcaec6891293e769465e77c.
Accidentally had this in my branch for my structural hash patch.
Added:
Modified:
clang/lib/Headers/cpuid.h
clang/test/Headers/cpuid.c
Removed:
clang/test/Headers/__cpuidex_conflict.c
################################################################################
diff --git a/clang/lib/Headers/cpuid.h b/clang/lib/Headers/cpuid.h
index 9b31db9f7d4f32..1ad6853a97c9d2 100644
--- a/clang/lib/Headers/cpuid.h
+++ b/clang/lib/Headers/cpuid.h
@@ -328,14 +328,4 @@ static __inline int __get_cpuid_count (unsigned int __leaf,
return 1;
}
-// In some configurations, __cpuidex is defined as a builtin (primarily
-// -fms-extensions) which will conflict with the __cpuidex definition below.
-#if !(__has_builtin(__cpuidex))
-static __inline void __cpuidex (int __cpu_info[4], int __leaf, int __subleaf)
-{
- __cpuid_count(__leaf, __subleaf, __cpu_info[0], __cpu_info[1], __cpu_info[2],
- __cpu_info[3]);
-}
-#endif
-
#endif /* __CPUID_H */
diff --git a/clang/test/Headers/__cpuidex_conflict.c b/clang/test/Headers/__cpuidex_conflict.c
deleted file mode 100644
index 8687a6aa2f897a..00000000000000
--- a/clang/test/Headers/__cpuidex_conflict.c
+++ /dev/null
@@ -1,22 +0,0 @@
-// Make sure that __cpuidex in cpuid.h doesn't conflict with the MS
-// extensions built in by ensuring compilation succeeds:
-// RUN: %clang_cc1 %s -ffreestanding -fms-extensions -fms-compatibility \
-// RUN: -fms-compatibility-version=19.00 -triple x86_64-pc-windows-msvc -emit-llvm -o -
-// %clang_cc1 %s -ffreestanding -triple x86_64-w64-windows-gnu -fms-extensions -emit-llvm -o -
-// RUN: %clang_cc1 %s -ffreestanding -fopenmp -fopenmp-is-target-device -aux-triple x86_64-unknown-linux-gnu
-
-typedef __SIZE_TYPE__ size_t;
-
-// We declare __cpuidex here as where the buitlin should be exposed (MSVC), the
-// declaration is in <intrin.h>, but <intrin.h> is not available from all the
-// targets that are being tested here.
-void __cpuidex (int[4], int, int);
-
-#include <cpuid.h>
-
-int cpuid_info[4];
-
-void test_cpuidex(unsigned level, unsigned count) {
- __cpuidex(cpuid_info, level, count);
-}
-
diff --git a/clang/test/Headers/cpuid.c b/clang/test/Headers/cpuid.c
index 6ed12eca7a61d4..7e485495c10665 100644
--- a/clang/test/Headers/cpuid.c
+++ b/clang/test/Headers/cpuid.c
@@ -6,19 +6,14 @@
// CHECK-64: {{.*}} call { i32, i32, i32, i32 } asm " xchgq %rbx,${1:q}\0A cpuid\0A xchgq %rbx,${1:q}", "={ax},=r,={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %{{[a-z0-9]+}})
// CHECK-64: {{.*}} call { i32, i32, i32, i32 } asm " xchgq %rbx,${1:q}\0A cpuid\0A xchgq %rbx,${1:q}", "={ax},=r,={cx},={dx},0,2,~{dirflag},~{fpsr},~{flags}"(i32 %{{[a-z0-9]+}}, i32 %{{[a-z0-9]+}})
-// CHECK-64: {{.*}} call { i32, i32, i32, i32 } asm " xchgq %rbx,${1:q}\0A cpuid\0A xchgq %rbx,${1:q}", "={ax},=r,={cx},={dx},0,2,~{dirflag},~{fpsr},~{flags}"(i32 %{{[a-z0-9]+}}, i32 %{{[a-z0-9]+}})
// CHECK-32: {{.*}} call { i32, i32, i32, i32 } asm "cpuid", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %{{[a-z0-9]+}})
// CHECK-32: {{.*}} call { i32, i32, i32, i32 } asm "cpuid", "={ax},={bx},={cx},={dx},0,2,~{dirflag},~{fpsr},~{flags}"(i32 %{{[a-z0-9]+}}, i32 %{{[a-z0-9]+}})
-// CHECK-32: {{.*}} call { i32, i32, i32, i32 } asm "cpuid", "={ax},={bx},={cx},={dx},0,2,~{dirflag},~{fpsr},~{flags}"(i32 %{{[a-z0-9]+}}, i32 %{{[a-z0-9]+}})
unsigned eax0, ebx0, ecx0, edx0;
unsigned eax1, ebx1, ecx1, edx1;
-int cpuid_info[4];
-
void test_cpuid(unsigned level, unsigned count) {
__cpuid(level, eax1, ebx1, ecx1, edx1);
__cpuid_count(level, count, eax0, ebx0, ecx0, edx0);
- __cpuidex(cpuid_info, level, count);
}
More information about the cfe-commits
mailing list