mips.c (mips_function_value): Handle complex return values.

* config/mips/mips.c (mips_function_value): Handle complex return
        values.

From-SVN: r45178
This commit is contained in:
Aldy Hernandez 2001-08-26 04:51:54 +00:00 committed by Aldy Hernandez
parent cf728d61ac
commit f9ad2367e7
2 changed files with 33 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2001-08-26 Aldy Hernandez <aldyh@redhat.com>
* config/mips/mips.c (mips_function_value): Handle complex return
values.
2001-08-25 Hans-Peter Nilsson <hp@bitrange.com>
* reload1.c (reload): Make all entries in reg_equiv_memory_loc

View File

@ -7782,8 +7782,7 @@ mips_function_value (valtype, func)
just as PROMOTE_MODE does. */
mode = promote_mode (valtype, mode, &unsignedp, 1);
/* ??? How should we return complex float? */
if (mclass == MODE_FLOAT || mclass == MODE_COMPLEX_FLOAT)
if (mclass == MODE_FLOAT)
{
if (TARGET_SINGLE_FLOAT
&& (mclass == MODE_FLOAT
@ -7793,6 +7792,33 @@ mips_function_value (valtype, func)
reg = FP_RETURN;
}
else if (mclass == MODE_COMPLEX_FLOAT)
{
if (TARGET_FLOAT64)
reg = FP_RETURN;
else if (mode == SCmode)
{
/* When FP registers are 32 bits, we can't directly reference
the odd numbered ones, so let's make a pair of evens. */
enum machine_mode cmode = TYPE_MODE (TREE_TYPE (valtype));
return gen_rtx_PARALLEL
(VOIDmode,
gen_rtvec (2,
gen_rtx_EXPR_LIST (VOIDmode,
gen_rtx_REG (cmode,
FP_RETURN),
GEN_INT (0)),
gen_rtx_EXPR_LIST (VOIDmode,
gen_rtx_REG (cmode,
FP_RETURN + 2),
GEN_INT (4))));
}
else
reg = FP_RETURN;
}
else if (TREE_CODE (valtype) == RECORD_TYPE
&& mips_abi != ABI_32
&& mips_abi != ABI_O64