Check that the input size is correct for the given constraint.

The 'a', 'c', and 'd' constraints on i386 mean a 32-bit register. We cannot
place a 64-bit value into the 32-bit register. Error out instead of causing the
compiler to spew general badness.
<rdar://problem/12415959>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167717 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGen/x86_32-inline-asm.c b/test/CodeGen/x86_32-inline-asm.c
new file mode 100644
index 0000000..0596ba4
--- /dev/null
+++ b/test/CodeGen/x86_32-inline-asm.c
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -verify %s
+// <rdar://problem/12415959>
+
+typedef unsigned int u_int32_t;
+typedef u_int32_t uint32_t;
+
+typedef unsigned long long u_int64_t;
+typedef u_int64_t uint64_t;
+
+int main () {
+  uint32_t msr = 0x8b;
+  uint64_t val = 0;
+  __asm__ volatile("wrmsr"
+                   :
+                   : "c" (msr),
+                     "a" ((val & 0xFFFFFFFFUL)), // expected-error {{invalid input size for constraint 'a'}}
+                     "d" (((val >> 32) & 0xFFFFFFFFUL)));
+}