summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog16
-rw-r--r--gcc/config/i386/i386-protos.h1
-rw-r--r--gcc/config/i386/i386.c42
-rw-r--r--gcc/config/i386/i386.opt4
-rw-r--r--gcc/config/i386/sol2-10.h7
-rw-r--r--gcc/config/i386/sol2.h10
-rw-r--r--gcc/config/i386/vx-common.h7
-rw-r--r--gcc/doc/invoke.texi13
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gcc.target/i386/pr22076.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr22152.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/vect8-ret.c13
12 files changed, 75 insertions, 48 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a176a7a33b5..37ff01b1789 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,19 @@
+2010-09-28 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR target/44452
+ * config/i386/i386.opt (mvect8-ret-in-mem): Define.
+ * config/i386/i386.c (ix86_target_string): Handle -mvect8-ret-in-mem.
+ (ix86_solaris_return_in_memory): Remove.
+ * config/i386/i386-protos.h (ix86_solaris_return_in_memory): Remove.
+ * config/i386/sol2.h (SUBTARGET_RETURN_IN_MEMORY): Remove.
+ (TARGET_SUBTARGET_DEFAULT): Redefine.
+ * config/i386/sol2-10.h (TARGET_SUBTARGET_DEFAULT): Update comment.
+ * config/i386/vx-common.h (SUBTARGET_RETURN_IN_MEMORY): Remove.
+ (TARGET_SUBTARGET_DEFAULT): Redefine.
+ * doc/invoke.texi (Option Summary, i386 and x86-64 Options): Add
+ -mvect8-ret-in-mem.
+ (i386 and x86-64 Options): Document -mvect8-ret-in-mem.
+
2010-09-29 Alan Modra <amodra@gmail.com>
PR target/45807
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index 700dec1e520..75562e8be90 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -140,7 +140,6 @@ extern rtx ix86_libcall_value (enum machine_mode);
extern bool ix86_function_arg_regno_p (int);
extern void ix86_asm_output_function_label (FILE *, const char *, tree);
extern int ix86_function_arg_boundary (enum machine_mode, const_tree);
-extern bool ix86_solaris_return_in_memory (const_tree, const_tree);
extern rtx ix86_force_to_memory (enum machine_mode, rtx);
extern void ix86_free_from_memory (enum machine_mode);
extern void ix86_call_abi_override (const_tree);
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 1d1c3007e0a..e164c4b457b 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -2632,6 +2632,7 @@ ix86_target_string (int isa, int flags, const char *arch, const char *tune,
{ "-msseregparm", MASK_SSEREGPARM },
{ "-mstack-arg-probe", MASK_STACK_PROBE },
{ "-mtls-direct-seg-refs", MASK_TLS_DIRECT_SEG_REFS },
+ { "-mvect8-ret-in-mem", MASK_VECT8_RETURNS },
{ "-m8bit-idiv", MASK_USE_8BIT_IDIV },
};
@@ -6849,9 +6850,9 @@ return_in_memory_32 (const_tree type, enum machine_mode mode)
return false;
/* MMX/3dNow values are returned in MM0,
- except when it doesn't exits. */
+ except when it doesn't exits or the ABI prescribes otherwise. */
if (size == 8)
- return !TARGET_MMX;
+ return !TARGET_MMX || TARGET_VECT8_RETURNS;
/* SSE values are returned in XMM0, except when it doesn't exist. */
if (size == 16)
@@ -6915,43 +6916,6 @@ ix86_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
#endif
}
-/* Return false iff TYPE is returned in memory. This version is used
- on Solaris 2. It is similar to the generic ix86_return_in_memory,
- but differs notably in that when MMX is available, 8-byte vectors
- are returned in memory, rather than in MMX registers. */
-
-bool
-ix86_solaris_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
-{
- int size;
- enum machine_mode mode = type_natural_mode (type, NULL);
-
- if (TARGET_64BIT)
- return return_in_memory_64 (type, mode);
-
- if (mode == BLKmode)
- return 1;
-
- size = int_size_in_bytes (type);
-
- if (VECTOR_MODE_P (mode))
- {
- /* Return in memory only if MMX registers *are* available. This
- seems backwards, but it is consistent with the existing
- Solaris x86 ABI. */
- if (size == 8)
- return TARGET_MMX;
- if (size == 16)
- return !TARGET_SSE;
- }
- else if (mode == TImode)
- return !TARGET_SSE;
- else if (mode == XFmode)
- return 0;
-
- return size > 12;
-}
-
/* When returning SSE vector types, we have a choice of either
(1) being abi incompatible with a -march switch, or
(2) generating an error.
diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
index 38a53f616c7..09a4e063cfd 100644
--- a/gcc/config/i386/i386.opt
+++ b/gcc/config/i386/i386.opt
@@ -244,6 +244,10 @@ mveclibabi=
Target RejectNegative Joined Var(ix86_veclibabi_string)
Vector library ABI to use
+mvect8-ret-in-mem
+Target Report Mask(VECT8_RETURNS) Save
+Return 8-byte vectors in memory
+
mrecip
Target Report Mask(RECIP) Save
Generate reciprocals instead of divss and sqrtss.
diff --git a/gcc/config/i386/sol2-10.h b/gcc/config/i386/sol2-10.h
index c7fdec9a1a3..d4f6450be01 100644
--- a/gcc/config/i386/sol2-10.h
+++ b/gcc/config/i386/sol2-10.h
@@ -89,9 +89,12 @@ along with GCC; see the file COPYING3. If not see
} \
while (0)
+/* Override i386/sol2.h version: return 8-byte vectors in MMX registers if
+ possible, matching Sun Studio 12 Update 1+ compilers and other x86
+ targets. */
#undef TARGET_SUBTARGET_DEFAULT
-#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP \
- | MASK_FLOAT_RETURNS)
+#define TARGET_SUBTARGET_DEFAULT \
+ (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
#define SUBTARGET_OPTIMIZATION_OPTIONS \
do \
diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h
index 57f75ea5092..b86308fe2fc 100644
--- a/gcc/config/i386/sol2.h
+++ b/gcc/config/i386/sol2.h
@@ -140,9 +140,15 @@ along with GCC; see the file COPYING3. If not see
/* Register the Solaris-specific #pragma directives. */
#define REGISTER_SUBTARGET_PRAGMAS() solaris_register_pragmas ()
+/* Undo i386/sysv4.h version. */
#undef SUBTARGET_RETURN_IN_MEMORY
-#define SUBTARGET_RETURN_IN_MEMORY(TYPE, FNTYPE) \
- ix86_solaris_return_in_memory (TYPE, FNTYPE)
+
+/* Augment i386/unix.h version to return 8-byte vectors in memory, matching
+ Sun Studio compilers until version 12, the only ones supported on
+ Solaris 8 and 9. */
+#undef TARGET_SUBTARGET_DEFAULT
+#define TARGET_SUBTARGET_DEFAULT \
+ (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_VECT8_RETURNS)
/* Output a simple call for .init/.fini. */
#define ASM_OUTPUT_CALL(FILE, FN) \
diff --git a/gcc/config/i386/vx-common.h b/gcc/config/i386/vx-common.h
index f4547f08848..e63b91eb72d 100644
--- a/gcc/config/i386/vx-common.h
+++ b/gcc/config/i386/vx-common.h
@@ -20,10 +20,11 @@ along with GCC; see the file COPYING3. If not see
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
-/* VxWorks uses the same ABI as Solaris 2. */
+/* VxWorks uses the same ABI as Solaris 2, so use i386/sol2.h version. */
-#define SUBTARGET_RETURN_IN_MEMORY(TYPE, FNTYPE) \
- ix86_solaris_return_in_memory (TYPE, FNTYPE)
+#undef TARGET_SUBTARGET_DEFAULT
+#define TARGET_SUBTARGET_DEFAULT \
+ (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_VECT8_RETURNS)
/* Provide our target specific DBX_REGISTER_NUMBER, as advertised by the
common svr4.h. VxWorks relies on the SVR4 numbering. */
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index bb17a0e2cac..51ce64740f4 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -601,7 +601,8 @@ Objective-C and Objective-C++ Dialects}.
-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
-m96bit-long-double -mregparm=@var{num} -msseregparm @gol
--mveclibabi=@var{type} -mpc32 -mpc64 -mpc80 -mstackrealign @gol
+-mveclibabi=@var{type} -mvect8-ret-in-mem @gol
+-mpc32 -mpc64 -mpc80 -mstackrealign @gol
-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
-mcmodel=@var{code-model} -mabi=@var{name} @gol
-m32 -m64 -mlarge-data-threshold=@var{num} @gol
@@ -12246,6 +12247,16 @@ function by using the function attribute @samp{sseregparm}.
modules with the same value, including any libraries. This includes
the system libraries and startup modules.
+@item -mvect8-ret-in-mem
+@opindex mvect8-ret-in-mem
+Return 8-byte vectors in memory instead of MMX registers. This is the
+default on Solaris~8 and 9 and VxWorks to match the ABI of the Sun
+Studio compilers until version 12. Later compiler versions (starting
+with Studio 12 Update~1) follow the ABI used by other x86 targets, which
+is the default on Solaris~10 and later. @emph{Only} use this option if
+you need to remain compatible with existing code produced by those
+previous compiler versions or older versions of GCC.
+
@item -mpc32
@itemx -mpc64
@itemx -mpc80
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b869844a260..efa86ca1fe2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2010-09-28 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR target/44452
+ * gcc.target/i386/pr22076.c: Add -mno-vect8-ret-in-mem on
+ i?86-*-solaris2.[89], *-*-vxworks*.
+ * gcc.target/i386/pr22152.c: Likewise.
+ * gcc.target/i386/vect8-ret.c: New test.
+
2010-09-28 Jie Zhang <jie@codesourcery.com>
* gcc.dg/Wcxx-compat-12.c: Add -fno-short-enums.
diff --git a/gcc/testsuite/gcc.target/i386/pr22076.c b/gcc/testsuite/gcc.target/i386/pr22076.c
index 5195f361c25..c1da4e9aa0a 100644
--- a/gcc/testsuite/gcc.target/i386/pr22076.c
+++ b/gcc/testsuite/gcc.target/i386/pr22076.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fomit-frame-pointer -flax-vector-conversions -mmmx" } */
+/* { dg-options "-O2 -fomit-frame-pointer -flax-vector-conversions -mmmx -mno-vect8-ret-in-mem" { target i?86-*-solaris2.[89] *-*-vxworks* } } */
#include <mmintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/pr22152.c b/gcc/testsuite/gcc.target/i386/pr22152.c
index 789d7b375da..4fade89ee7f 100644
--- a/gcc/testsuite/gcc.target/i386/pr22152.c
+++ b/gcc/testsuite/gcc.target/i386/pr22152.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -msse2" } */
+/* { dg-options "-O2 -msse2 -mno-vect8-ret-in-mem" { target i?86-*-solaris2.[89] *-*-vxworks* } } */
#include <mmintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/vect8-ret.c b/gcc/testsuite/gcc.target/i386/vect8-ret.c
new file mode 100644
index 00000000000..f2eb81b3863
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect8-ret.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target ilp32 } } */
+/* { dg-options "-mmmx" { target i?86-*-solaris2.[89] *-*-vxworks* } } */
+/* { dg-options "-mmmx -mvect8-ret-in-mem" } */
+
+#include <mmintrin.h>
+
+__m64
+vecret (__m64 vect)
+{
+ return vect;
+}
+
+/* { dg-final { scan-assembler-times "movq" 1 } } */