aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSameera Deshpande <sameera.deshpande@imgtec.com>2017-02-22 23:09:43 +0000
committerMatthew Fortune <mpf@gcc.gnu.org>2017-02-22 23:09:43 +0000
commit0a864a97e9ab9b1bb6dbf13d6b471460c451be88 (patch)
treea2b20a0a58ac94b32ffcaeafa38127e1514f1146
parent349c635163ea53a276c755a7bbcb278e1eefef3e (diff)
downloadgcc-0a864a97e9ab9b1bb6dbf13d6b471460c451be88.zip
gcc-0a864a97e9ab9b1bb6dbf13d6b471460c451be88.tar.gz
gcc-0a864a97e9ab9b1bb6dbf13d6b471460c451be88.tar.bz2
Fix MIPS o32 calling convention for MSA and FP vector types
gcc/ * config/mips/mips.c (mips_return_in_memory): Force FP vector types to be returned in memory for o32 ABI. gcc/testsuite/ * gcc.target/mips/msa-fp-cc.c: New test. From-SVN: r245666
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/mips/mips.c10
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.target/mips/msa-fp-cc.c19
4 files changed, 35 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f6168c9..9654753 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2017-02-22 Sameera Deshpande <sameera.deshpande@imgtec.com>
+
+ * config/mips/mips.c (mips_return_in_memory): Force FP
+ vector types to be returned in memory for o32 ABI.
+
2017-02-22 Jakub Jelinek <jakub@redhat.com>
* dwarf2out.c (gen_variable_die): For -gdwarf-5, use DW_TAG_variable
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 7974a16..4e13fbe 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -6472,9 +6472,13 @@ mips_function_value_regno_p (const unsigned int regno)
static bool
mips_return_in_memory (const_tree type, const_tree fndecl ATTRIBUTE_UNUSED)
{
- return (TARGET_OLDABI
- ? TYPE_MODE (type) == BLKmode
- : !IN_RANGE (int_size_in_bytes (type), 0, 2 * UNITS_PER_WORD));
+ if (TARGET_OLDABI)
+ /* Ensure that any floating point vector types are returned via memory
+ even if they are supported through a vector mode with some ASEs. */
+ return (VECTOR_FLOAT_TYPE_P (type)
+ || TYPE_MODE (type) == BLKmode);
+
+ return (!IN_RANGE (int_size_in_bytes (type), 0, 2 * UNITS_PER_WORD));
}
/* Implement TARGET_SETUP_INCOMING_VARARGS. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9279d58..ea5e251 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2017-02-22 Sameera Deshpande <sameera.deshpande@imgtec.com>
+
+ * gcc.target/mips/msa-fp-cc.c: New test.
+
2017-02-22 Jakub Jelinek <jakub@redhat.com>
PR c++/79664
diff --git a/gcc/testsuite/gcc.target/mips/msa-fp-cc.c b/gcc/testsuite/gcc.target/mips/msa-fp-cc.c
new file mode 100644
index 0000000..3d293f3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/msa-fp-cc.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-mabi=32 -mfp64 -mhard-float -mmsa" } */
+typedef float v4f32 __attribute__((vector_size(16)));
+typedef double v2f64 __attribute__((vector_size(16)));
+
+v4f32
+fcmpOeqVector4 (v4f32 a, v4f32 b)
+{
+ return a + b;
+}
+
+v2f64
+fcmpOeqVector2 (v2f64 a, v2f64 b)
+{
+ return a + b;
+}
+
+/* { dg-final { scan-assembler-not "copy_s" } } */
+/* { dg-final { scan-assembler-not "insert" } } */