i386.c (ix86_value_regno): Don't return FIRST_MMX_REG if !TARGET_MMX...
authorRoger Sayle <roger@eyesopen.com>
Tue, 22 Aug 2006 12:42:41 +0000 (12:42 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Tue, 22 Aug 2006 12:42:41 +0000 (12:42 +0000)
* config/i386/i386.c (ix86_value_regno): Don't return FIRST_MMX_REG
if !TARGET_MMX, and don't return FIRST_SSE_REG if !TARGET_SSE.

From-SVN: r116321

gcc/ChangeLog
gcc/config/i386/i386.c

index 685b4b6daf9aebd3f697667baf40292aa71b3c06..136ba9dd9d21d334716118e81da933babb5b5d07 100644 (file)
@@ -1,3 +1,8 @@
+2006-08-22  Roger Sayle  <roger@eyesopen.com>
+
+       * config/i386/i386.c (ix86_value_regno): Don't return FIRST_MMX_REG
+       if !TARGET_MMX, and don't return FIRST_SSE_REG if !TARGET_SSE.
+
 2006-08-21  Jason Merrill  <jason@redhat.com>
 
        PR c++/27115
index fe0d516c05ee0bfd87703d0573b96dd5c6fa5ca0..5161ddaa693ce7ba3611301a584cb59afcdab813 100644 (file)
@@ -3980,14 +3980,16 @@ ix86_value_regno (enum machine_mode mode, tree func, tree fntype)
   gcc_assert (!TARGET_64BIT);
 
   /* 8-byte vector modes in %mm0. See ix86_return_in_memory for where
-     we prevent this case when mmx is not available.  */
-  if ((VECTOR_MODE_P (mode) && GET_MODE_SIZE (mode) == 8))
-    return FIRST_MMX_REG;
+     we normally prevent this case when mmx is not available.  However
+     some ABIs may require the result to be returned like DImode.  */
+  if (VECTOR_MODE_P (mode) && GET_MODE_SIZE (mode) == 8)
+    return TARGET_MMX ? FIRST_MMX_REG : 0;
 
   /* 16-byte vector modes in %xmm0.  See ix86_return_in_memory for where
-     we prevent this case when sse is not available.  */
+     we prevent this case when sse is not available.  However some ABIs
+     may require the result to be returned like integer TImode.  */
   if (mode == TImode || (VECTOR_MODE_P (mode) && GET_MODE_SIZE (mode) == 16))
-    return FIRST_SSE_REG;
+    return TARGET_SSE ? FIRST_SSE_REG : 0;
 
   /* Decimal floating point values can go in %eax, unlike other float modes.  */
   if (DECIMAL_FLOAT_MODE_P (mode))