diff --git a/lib/Headers/cpuid.h b/lib/Headers/cpuid.h
index f9254e9..861c0c5 100644
--- a/lib/Headers/cpuid.h
+++ b/lib/Headers/cpuid.h
@@ -100,7 +100,7 @@
           "  mov    %%ebx,%1\n" \
           "  popl   %%ebx" \
         : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
-        : "0"(__level))
+        : "0"(__level) : "ebx")
 
 #define __cpuid_count(__level, __count, __eax, __ebx, __ecx, __edx) \
     __asm("  pushl  %%ebx\n" \
diff --git a/test/Headers/cpuid.c b/test/Headers/cpuid.c
new file mode 100644
index 0000000..a8bcf1d
--- /dev/null
+++ b/test/Headers/cpuid.c
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 %s -triple i386-apple-macosx10.9.0 -emit-llvm -o - | FileCheck %s
+
+#include <cpuid.h>
+
+// __cpuid should have register ebx in the clobber list in order to prevent
+// it from being selected for operand %1.
+
+// __asm("  pushl  %%ebx\n" \
+//       "  cpuid\n" \
+//       "  mov    %%ebx,%1\n" \
+//       "  popl   %%ebx" \
+//       : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
+//       : "0"(__level) : "ebx")
+
+// ## InlineAsm End
+
+// CHECK: ~{ebx}
+
+void test_cpuid(int level, int *a, int *b, int *c, int *d) {
+  __asm("nop" : "=b" (*b));
+  __cpuid(level, *a, *b, *c, *d);
+}
