aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorUros Bizjak <uros@kss-loka.si>2005-06-10 23:45:12 +0200
committerRichard Henderson <rth@gcc.gnu.org>2005-06-10 14:45:12 -0700
commit74c4a88aff99400421d4880f45a33d01458a8cc6 (patch)
tree08909fe3efd3c3f07a386b7815e88f18584bed66 /gcc
parentc45af542bdbfa069cbc8318373b5c199de168969 (diff)
downloadgcc-74c4a88aff99400421d4880f45a33d01458a8cc6.zip
gcc-74c4a88aff99400421d4880f45a33d01458a8cc6.tar.gz
gcc-74c4a88aff99400421d4880f45a33d01458a8cc6.tar.bz2
re PR target/21981 ([4.0 only] __m64 return value should be returned in %mm0)
PR target/21981 * config/i386/i386.c (ix86_function_value_regno_p): Return true for FIRST_MMX_REG if TARGET_MMX. (ix86_return_in_memory): Return 1 for MMX/3dNow vectors. Delete wrong comment. (ix86_struct_value_rtx): Emit warning for MMX ABI violations. (ix86_value_regno): Return FIRST_MMX_REG for MMX vector modes. From-SVN: r100832
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/i386/i386.c38
2 files changed, 39 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8b204a5..7d6fc6a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2005-06-10 Uros Bizjak <uros@kss-loka.si>
+
+ PR target/21981
+ * config/i386/i386.c (ix86_function_value_regno_p): Return true
+ for FIRST_MMX_REG if TARGET_MMX.
+ (ix86_return_in_memory): Return 1 for MMX/3dNow vectors. Delete
+ wrong comment.
+ (ix86_struct_value_rtx): Emit warning for MMX ABI violations.
+ (ix86_value_regno): Return FIRST_MMX_REG for MMX vector modes.
+
2005-06-10 Daniel Berlin <dberlin@dberlin.org>
* lambda-code.c (replace_uses_equiv_to_x_with_y): Check step
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 8dd2d15..dfaac94 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3104,6 +3104,7 @@ ix86_function_value_regno_p (int regno)
{
return ((regno) == 0
|| ((regno) == FIRST_FLOAT_REG && TARGET_FLOAT_RETURNS_IN_80387)
+ || ((regno) == FIRST_MMX_REG && TARGET_MMX)
|| ((regno) == FIRST_SSE_REG && TARGET_SSE));
}
return ((regno) == 0 || (regno) == FIRST_FLOAT_REG
@@ -3159,10 +3160,10 @@ ix86_return_in_memory (tree type)
if (size < 8)
return 0;
- /* MMX/3dNow values are returned on the stack, since we've
- got to EMMS/FEMMS before returning. */
+ /* MMX/3dNow values are returned in MM0,
+ except when it doesn't exits. */
if (size == 8)
- return 1;
+ return (TARGET_MMX ? 0 : 1);
/* SSE values are returned in XMM0, except when it doesn't exist. */
if (size == 16)
@@ -3191,18 +3192,32 @@ ix86_return_in_memory (tree type)
static rtx
ix86_struct_value_rtx (tree type, int incoming ATTRIBUTE_UNUSED)
{
- static bool warned;
+ static bool warnedsse, warnedmmx;
- if (!TARGET_SSE && type && !warned)
+ if (type)
{
/* Look at the return type of the function, not the function type. */
enum machine_mode mode = TYPE_MODE (TREE_TYPE (type));
- if (mode == TImode
- || (VECTOR_MODE_P (mode) && GET_MODE_SIZE (mode) == 16))
+ if (!TARGET_SSE && !warnedsse)
{
- warned = true;
- warning (0, "SSE vector return without SSE enabled changes the ABI");
+ if (mode == TImode
+ || (VECTOR_MODE_P (mode) && GET_MODE_SIZE (mode) == 16))
+ {
+ warnedsse = true;
+ warning (0, "SSE vector return without SSE enabled "
+ "changes the ABI");
+ }
+ }
+
+ if (!TARGET_MMX && !warnedmmx)
+ {
+ if (VECTOR_MODE_P (mode) && GET_MODE_SIZE (mode) == 8)
+ {
+ warnedmmx = true;
+ warning (0, "MMX vector return without MMX enabled "
+ "changes the ABI");
+ }
}
}
@@ -3244,6 +3259,11 @@ ix86_value_regno (enum machine_mode mode, tree func)
{
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;
+
/* 16-byte vector modes in %xmm0. See ix86_return_in_memory for where
we prevent this case when sse is not available. */
if (mode == TImode || (VECTOR_MODE_P (mode) && GET_MODE_SIZE (mode) == 16))