aidengrossman created this revision. Herald added a project: All. aidengrossman requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
This reverts commit 2df77ac20a1ed996706b164b0c4ed5ad140f635f <https://reviews.llvm.org/rG2df77ac20a1ed996706b164b0c4ed5ad140f635f>. This has been causing some issues with some windows builds as `_MSC_EXTENSIONS` isn't defined when only `-fms-extensions` is set, but the builtin that conflicts with __cpuidex is. This was also causing problems as it exposed some latent issues with how auxiliary triples are handled in clang. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D157115 Files: clang/lib/Headers/cpuid.h clang/test/Headers/__cpuidex_conflict.c clang/test/Headers/cpuid.c Index: clang/test/Headers/cpuid.c =================================================================== --- clang/test/Headers/cpuid.c +++ 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); } Index: clang/test/Headers/__cpuidex_conflict.c =================================================================== --- clang/test/Headers/__cpuidex_conflict.c +++ /dev/null @@ -1,15 +0,0 @@ -// Make sure that __cpuidex in cpuid.h doesn't conflict with the MS -// compatibility 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 - - -typedef __SIZE_TYPE__ size_t; - -#include <intrin.h> -#include <cpuid.h> - -int cpuid_info[4]; - -void test_cpuidex(unsigned level, unsigned count) { - __cpuidex(cpuid_info, level, count); -} Index: clang/lib/Headers/cpuid.h =================================================================== --- clang/lib/Headers/cpuid.h +++ clang/lib/Headers/cpuid.h @@ -328,14 +328,4 @@ return 1; } -// If MS extensions are enabled, __cpuidex is defined as a builtin which will -// conflict with the __cpuidex definition below. -#ifndef _MSC_EXTENSIONS -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 */
Index: clang/test/Headers/cpuid.c =================================================================== --- clang/test/Headers/cpuid.c +++ 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); } Index: clang/test/Headers/__cpuidex_conflict.c =================================================================== --- clang/test/Headers/__cpuidex_conflict.c +++ /dev/null @@ -1,15 +0,0 @@ -// Make sure that __cpuidex in cpuid.h doesn't conflict with the MS -// compatibility 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 - - -typedef __SIZE_TYPE__ size_t; - -#include <intrin.h> -#include <cpuid.h> - -int cpuid_info[4]; - -void test_cpuidex(unsigned level, unsigned count) { - __cpuidex(cpuid_info, level, count); -} Index: clang/lib/Headers/cpuid.h =================================================================== --- clang/lib/Headers/cpuid.h +++ clang/lib/Headers/cpuid.h @@ -328,14 +328,4 @@ return 1; } -// If MS extensions are enabled, __cpuidex is defined as a builtin which will -// conflict with the __cpuidex definition below. -#ifndef _MSC_EXTENSIONS -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 */
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits