X86-64 ABI: pass structs shorter than 4 bytes as
i16 or i8.  Fixes 477.dealII.

llvm-svn: 51971
diff --git a/llvm-gcc-4.2/gcc/config/i386/llvm-i386.cpp b/llvm-gcc-4.2/gcc/config/i386/llvm-i386.cpp
index db46d0c..c1e90b4 100644
--- a/llvm-gcc-4.2/gcc/config/i386/llvm-i386.cpp
+++ b/llvm-gcc-4.2/gcc/config/i386/llvm-i386.cpp
@@ -1316,29 +1316,27 @@
     int NumClasses = ix86_ClassifyArgument(Mode, type, Class, 0);
     *DontCheckAlignment= true;
     if (NumClasses == 1 && Class[0] == X86_64_INTEGER_CLASS) {
-      /* 8 byte object, one int register */
+      // one int register
       *size = 8;
       return true;
     }
     if (NumClasses == 1 && Class[0] == X86_64_INTEGERSI_CLASS) {
-      /* 4 byte object, one int register */
-      *size = 4;
+      // one shorter-than-64-bits register
+      HOST_WIDE_INT Bytes =
+        (Mode == BLKmode) ? int_size_in_bytes(type) : (int) GET_MODE_SIZE(Mode);
+      *size = Bytes;
       return true;
     }
     if (NumClasses == 2 && (Class[0] == X86_64_INTEGERSI_CLASS ||
                             Class[0] == X86_64_INTEGER_CLASS)) {
       if (Class[1] == X86_64_INTEGER_CLASS) {
-        /* 16 byte object, 2 int registers */
+        // 16 byte object, 2 int registers
         *size = 16;
         return true;
       }
-      if (Class[1] == X86_64_INTEGERSI_CLASS) {
-        /* 12 byte object, 2 int registers */
-        *size = 12;
-        return true;
-      }
+      // IntegerSI can occur only as element 0.
       if (Class[1] == X86_64_NO_CLASS) {
-        /* 16 byte object, only 1st register has information */
+        // 16 byte object, only 1st register has information
         *size = 8;
         return true;
       }