This revision was automatically updated to reflect the committed changes.
Closed by commit rL346265: [MS] Zero out ECX in __cpuid in intrin.h (authored 
by rnk, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D54171?vs=172811&id=172831#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D54171

Files:
  cfe/trunk/lib/Headers/intrin.h
  cfe/trunk/test/CodeGen/ms-intrinsics-cpuid.c


Index: cfe/trunk/test/CodeGen/ms-intrinsics-cpuid.c
===================================================================
--- cfe/trunk/test/CodeGen/ms-intrinsics-cpuid.c
+++ cfe/trunk/test/CodeGen/ms-intrinsics-cpuid.c
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
+// RUN:         -triple i686-windows-msvc -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
+// RUN:         -triple x86_64-windows-msvc -emit-llvm %s -o - | FileCheck %s
+
+// intrin.h needs size_t, but -ffreestanding prevents us from getting it from
+// stddef.h.  Work around it with this typedef.
+typedef __SIZE_TYPE__ size_t;
+
+#include <intrin.h>
+
+void test__cpuid(int *info, int level) {
+  __cpuid(info, level);
+}
+// CHECK-LABEL: define {{.*}} @test__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)
Index: cfe/trunk/lib/Headers/intrin.h
===================================================================
--- cfe/trunk/lib/Headers/intrin.h
+++ cfe/trunk/lib/Headers/intrin.h
@@ -535,7 +535,7 @@
 static __inline__ void __DEFAULT_FN_ATTRS
 __cpuid(int __info[4], int __level) {
   __asm__ ("cpuid" : "=a"(__info[0]), "=b" (__info[1]), "=c"(__info[2]), 
"=d"(__info[3])
-                   : "a"(__level));
+                   : "a"(__level), "c"(0));
 }
 static __inline__ void __DEFAULT_FN_ATTRS
 __cpuidex(int __info[4], int __level, int __ecx) {


Index: cfe/trunk/test/CodeGen/ms-intrinsics-cpuid.c
===================================================================
--- cfe/trunk/test/CodeGen/ms-intrinsics-cpuid.c
+++ cfe/trunk/test/CodeGen/ms-intrinsics-cpuid.c
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
+// RUN:         -triple i686-windows-msvc -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
+// RUN:         -triple x86_64-windows-msvc -emit-llvm %s -o - | FileCheck %s
+
+// intrin.h needs size_t, but -ffreestanding prevents us from getting it from
+// stddef.h.  Work around it with this typedef.
+typedef __SIZE_TYPE__ size_t;
+
+#include <intrin.h>
+
+void test__cpuid(int *info, int level) {
+  __cpuid(info, level);
+}
+// CHECK-LABEL: define {{.*}} @test__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)
Index: cfe/trunk/lib/Headers/intrin.h
===================================================================
--- cfe/trunk/lib/Headers/intrin.h
+++ cfe/trunk/lib/Headers/intrin.h
@@ -535,7 +535,7 @@
 static __inline__ void __DEFAULT_FN_ATTRS
 __cpuid(int __info[4], int __level) {
   __asm__ ("cpuid" : "=a"(__info[0]), "=b" (__info[1]), "=c"(__info[2]), "=d"(__info[3])
-                   : "a"(__level));
+                   : "a"(__level), "c"(0));
 }
 static __inline__ void __DEFAULT_FN_ATTRS
 __cpuidex(int __info[4], int __level, int __ecx) {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to