// 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 () {
  // Error out if size is > 32-bits.
  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)));

  // Don't error out if the size of the destination is <= 32 bits.
  unsigned char data;
  unsigned int port;
  __asm__ volatile("outb %0, %w1" : : "a" (data), "Nd" (port)); // No error expected.
}

// 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)));
}

--- 
+++ 
@@ -8,6 +8,7 @@
 typedef u_int64_t uint64_t;
 
 int main () {
+  // Error out if size is > 32-bits.
   uint32_t msr = 0x8b;
   uint64_t val = 0;
   __asm__ volatile("wrmsr"
@@ -15,4 +16,9 @@
                    : "c" (msr),
                      "a" ((val & 0xFFFFFFFFUL)), // expected-error {{invalid input size for constraint 'a'}}
                      "d" (((val >> 32) & 0xFFFFFFFFUL)));
+
+  // Don't error out if the size of the destination is <= 32 bits.
+  unsigned char data;
+  unsigned int port;
+  __asm__ volatile("outb %0, %w1" : : "a" (data), "Nd" (port)); // No error expected.
 }
Update testcase to show that we don't emit an error for sizes <= 32-bits.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@167748 91177308-0d34-0410-b5e6-96231b3b80d8
