diff --git a/clang/lib/Headers/intrin.h b/clang/lib/Headers/intrin.h --- a/clang/lib/Headers/intrin.h +++ b/clang/lib/Headers/intrin.h @@ -507,12 +507,12 @@ |* Misc \*----------------------------------------------------------------------------*/ #if defined(__i386__) || defined(__x86_64__) -static __inline__ void __DEFAULT_FN_ATTRS __cpuid(int __info[4], int __level) { +static void __attribute__((noinline, __nodebug__)) __cpuid(int __info[4], int __level) { __asm__("cpuid" : "=a"(__info[0]), "=b"(__info[1]), "=c"(__info[2]), "=d"(__info[3]) : "a"(__level), "c"(0)); } -static __inline__ void __DEFAULT_FN_ATTRS __cpuidex(int __info[4], int __level, +static void __attribute__((noinline, __nodebug__)) __cpuidex(int __info[4], int __level, int __ecx) { __asm__("cpuid" : "=a"(__info[0]), "=b"(__info[1]), "=c"(__info[2]), "=d"(__info[3]) diff --git a/clang/test/CodeGen/ms-intrinsics-cpuid.c b/clang/test/CodeGen/ms-intrinsics-cpuid.c --- a/clang/test/CodeGen/ms-intrinsics-cpuid.c +++ b/clang/test/CodeGen/ms-intrinsics-cpuid.c @@ -12,7 +12,15 @@ void test__cpuid(int *info, int level) { __cpuid(info, level); } -// CHECK-LABEL: define {{.*}} @test__cpuid(i32* %{{.*}}, i32 %{{.*}}) +// CHECK-LABEL: define {{.*}} @__cpuid(i32* %{{.*}}, i32 %{{.*}}) // CHECK: call { i32, i32, i32, i32 } asm "cpuid", // CHECK-SAME: "={ax},={bx},={cx},={dx},{ax},{cx},~{dirflag},~{fpsr},~{flags}" // CHECK-SAME: (i32 %{{.*}}, i32 0) + +// CHECK-LABEL: define {{.*}} @__cpuidex(i32* %{{.*}}, i32 %{{.*}}, i32 %{{.*}}) +// CHECK: call { i32, i32, i32, i32 } asm "cpuid", +// CHECK-SAME: "={ax},={bx},={cx},={dx},{ax},{cx},~{dirflag},~{fpsr},~{flags}" +// CHECK-SAME: (i32 %{{.*}}, i32 %{{.*}}) + +// CHECK-LABEL: define {{.*}} @test__cpuid(i32* %{{.*}}, i32 %{{.*}}) +// CHECK: call void @__cpuid(i32* %{{.*}}, i32 %{{.*}})