[llvm-commits] [llvm-gcc-4.2] r93649 - /llvm-gcc-4.2/trunk/gcc/config/i386/i386.c

Stuart Hastings stuart at apple.com
Sat Jan 16 11:30:19 PST 2010


Author: stuart
Date: Sat Jan 16 13:30:18 2010
New Revision: 93649

URL: http://llvm.org/viewvc/llvm-project?rev=93649&view=rev
Log:
More fine-tuning of the x86-64 ABI.

The previous patch corrected the 128-bit store into a 96-bit struct,
but it mistakenly passed a 128-bit aligned 32-bit struct as a 128-bit
object.

Modified:
    llvm-gcc-4.2/trunk/gcc/config/i386/i386.c

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.c?rev=93649&r1=93648&r2=93649&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/i386.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.c Sat Jan 16 13:30:18 2010
@@ -3474,16 +3474,24 @@
 	    for (i = 0; i < words; i++)
 	      classes[i] = subclasses[i % num];
 
-	    /* If 32-bit class, consider upgrade to 64-bit.  */
-	    if (bytes > 4 &&
-		(subclasses[0] == X86_64_SSESF_CLASS ||
-		 subclasses[0] == X86_64_INTEGERSI_CLASS)) {
-		enum x86_64_reg_class upgrade64 =
-		  (subclasses[0] == X86_64_SSESF_CLASS) ?
+	    /* If the first register has a 32-bit class, but there are
+	       more than 32-bits in the type, upgrade it to the
+	       corresponding 64-bit class.  */
+	    if ((bytes > 4) &&
+		((subclasses[0] == X86_64_SSESF_CLASS) ||
+		 (subclasses[0] == X86_64_INTEGERSI_CLASS))) {
+		classes[0] = (subclasses[0] == X86_64_SSESF_CLASS) ?
 		  X86_64_SSE_CLASS : X86_64_INTEGER_CLASS;
-		classes[0] = upgrade64;
-		if (bytes > 12)
-		  classes[1] = upgrade64;
+		/* subclasses[1] is only valid if num == 2.  If it's
+		   invalid, or it's set to a 32-bit class, AND there
+		   are more than twelve bytes in the type, upgrade the
+		   second register to 64-bits.  (If we got here, the
+		   first register already has a 64-bit class.)  */
+		if (bytes > 12 &&
+		    (num == 1 ||
+		     subclasses[1] == X86_64_SSESF_CLASS ||
+		     subclasses[1] == X86_64_INTEGERSI_CLASS))
+		  classes[1] = classes[0];
 	    }
 	  }
 	  break;





More information about the llvm-commits mailing list