aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2006-06-21 11:36:53 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2006-06-21 11:36:53 +0100
commit0882b52ec44c2b61e81da585ab613808f5bf7dc8 (patch)
tree766e7ce8c8e171b7d75ff576ea71e76bd233126f /gcc
parent0f57bf40b889941ee61338063068f50d73e8d86d (diff)
downloadgcc-0882b52ec44c2b61e81da585ab613808f5bf7dc8.zip
gcc-0882b52ec44c2b61e81da585ab613808f5bf7dc8.tar.gz
gcc-0882b52ec44c2b61e81da585ab613808f5bf7dc8.tar.bz2
mips.c (function_arg): Where one part of a complex argument is in registers and the other part in the...
* config/mips/mips.c (function_arg): Where one part of a complex argument is in registers and the other part in the stack, return a REG not a PARALLEL. testsuite: * gcc.c-torture/execute/complex-7.c: New. From-SVN: r114847
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/mips/mips.c25
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/complex-7.c56
4 files changed, 84 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3fe0c52..d3d05e1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2006-06-21 Joseph Myers <joseph@codesourcery.com>
+
+ * config/mips/mips.c (function_arg): Where one part of a
+ complex argument is in registers and the other part in the stack,
+ return a REG not a PARALLEL.
+
2006-06-21 Mark Mitchell <mark@codesourcery.com>
* configure.ac: Set gcc_gxx_include_dir to $target/include/c++
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index d879402..5f88ed5 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -3894,13 +3894,24 @@ function_arg (const CUMULATIVE_ARGS *cum, enum machine_mode mode,
inner = GET_MODE_INNER (mode);
reg = FP_ARG_FIRST + info.reg_offset;
- real = gen_rtx_EXPR_LIST (VOIDmode,
- gen_rtx_REG (inner, reg),
- const0_rtx);
- imag = gen_rtx_EXPR_LIST (VOIDmode,
- gen_rtx_REG (inner, reg + info.reg_words / 2),
- GEN_INT (GET_MODE_SIZE (inner)));
- return gen_rtx_PARALLEL (mode, gen_rtvec (2, real, imag));
+ if (info.reg_words * UNITS_PER_WORD == GET_MODE_SIZE (inner))
+ {
+ /* Real part in registers, imaginary part on stack. */
+ gcc_assert (info.stack_words == info.reg_words);
+ return gen_rtx_REG (inner, reg);
+ }
+ else
+ {
+ gcc_assert (info.stack_words == 0);
+ real = gen_rtx_EXPR_LIST (VOIDmode,
+ gen_rtx_REG (inner, reg),
+ const0_rtx);
+ imag = gen_rtx_EXPR_LIST (VOIDmode,
+ gen_rtx_REG (inner,
+ reg + info.reg_words / 2),
+ GEN_INT (GET_MODE_SIZE (inner)));
+ return gen_rtx_PARALLEL (mode, gen_rtvec (2, real, imag));
+ }
}
if (!info.fpr_p)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 84dd889..93cb39e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2006-06-21 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.c-torture/execute/complex-7.c: New.
+
2006-06-21 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/merge-all-constants-1.c: New test.
diff --git a/gcc/testsuite/gcc.c-torture/execute/complex-7.c b/gcc/testsuite/gcc.c-torture/execute/complex-7.c
new file mode 100644
index 0000000..c5bf89d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/complex-7.c
@@ -0,0 +1,56 @@
+/* Test argument passing of complex values. The MIPS64 compiler had a
+ bug when they were split between registers and the stack. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+
+volatile _Complex float f1 = 1.1f + 2.2if;
+volatile _Complex float f2 = 3.3f + 4.4if;
+volatile _Complex float f3 = 5.5f + 6.6if;
+volatile _Complex float f4 = 7.7f + 8.8if;
+volatile _Complex float f5 = 9.9f + 10.1if;
+volatile _Complex double d1 = 1.1 + 2.2i;
+volatile _Complex double d2 = 3.3 + 4.4i;
+volatile _Complex double d3 = 5.5 + 6.6i;
+volatile _Complex double d4 = 7.7 + 8.8i;
+volatile _Complex double d5 = 9.9 + 10.1i;
+volatile _Complex long double ld1 = 1.1L + 2.2iL;
+volatile _Complex long double ld2 = 3.3L + 4.4iL;
+volatile _Complex long double ld3 = 5.5L + 6.6iL;
+volatile _Complex long double ld4 = 7.7L + 8.8iL;
+volatile _Complex long double ld5 = 9.9L + 10.1iL;
+
+extern void abort (void);
+extern void exit (int);
+
+__attribute__((noinline)) void
+check_float (int a, _Complex float a1, _Complex float a2,
+ _Complex float a3, _Complex float a4, _Complex float a5)
+{
+ if (a1 != f1 || a2 != f2 || a3 != f3 || a4 != f4 || a5 != f5)
+ abort ();
+}
+
+__attribute__((noinline)) void
+check_double (int a, _Complex double a1, _Complex double a2,
+ _Complex double a3, _Complex double a4, _Complex double a5)
+{
+ if (a1 != d1 || a2 != d2 || a3 != d3 || a4 != d4 || a5 != d5)
+ abort ();
+}
+
+__attribute__((noinline)) void
+check_long_double (int a, _Complex long double a1, _Complex long double a2,
+ _Complex long double a3, _Complex long double a4,
+ _Complex long double a5)
+{
+ if (a1 != ld1 || a2 != ld2 || a3 != ld3 || a4 != ld4 || a5 != ld5)
+ abort ();
+}
+
+int
+main (void)
+{
+ check_float (0, f1, f2, f3, f4, f5);
+ check_double (0, d1, d2, d3, d4, d5);
+ check_long_double (0, ld1, ld2, ld3, ld4, ld5);
+ exit (0);
+}