From d85b9058d6f26ff14a83752072abd77bbacf1226 Mon Sep 17 00:00:00 2001 From: jakub Date: Sun, 31 Mar 2002 18:43:31 +0000 Subject: [PATCH] * config/sparc/sparc.c (function_arg_record_value_1): Pass complex floating fields in float regs. (function_arg_record_value_2): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@51667 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/config/sparc/sparc.c | 40 +++++++++++++++++++++++++++++++++------- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a982a4c..bf94217 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2002-03-31 Jakub Jelinek + + * config/sparc/sparc.c (function_arg_record_value_1): Pass complex + floating fields in float regs. + (function_arg_record_value_2): Likewise. + 2002-03-31 Hans-Peter Nilsson * config/mmix/mmix.md (define_constants): Remove misleading diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 014656f..4071f5a 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -4245,7 +4245,10 @@ function_arg_record_value_1 (type, startbitpos, parms) if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE) function_arg_record_value_1 (TREE_TYPE (field), bitpos, parms); - else if (TREE_CODE (TREE_TYPE (field)) == REAL_TYPE + else if ((TREE_CODE (TREE_TYPE (field)) == REAL_TYPE + || (TREE_CODE (TREE_TYPE (field)) == COMPLEX_TYPE + && (TREE_CODE (TREE_TYPE (TREE_TYPE (field))) + == REAL_TYPE))) && TARGET_FPU && ! packed_p && parms->named) @@ -4268,6 +4271,8 @@ function_arg_record_value_1 (type, startbitpos, parms) /* There's no need to check this_slotno < SPARC_FP_ARG MAX. If it wasn't true we wouldn't be here. */ parms->nregs += 1; + if (TREE_CODE (TREE_TYPE (field)) == COMPLEX_TYPE) + parms->nregs += 1; } else { @@ -4371,24 +4376,45 @@ function_arg_record_value_2 (type, startbitpos, parms) if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE) function_arg_record_value_2 (TREE_TYPE (field), bitpos, parms); - else if (TREE_CODE (TREE_TYPE (field)) == REAL_TYPE + else if ((TREE_CODE (TREE_TYPE (field)) == REAL_TYPE + || (TREE_CODE (TREE_TYPE (field)) == COMPLEX_TYPE + && (TREE_CODE (TREE_TYPE (TREE_TYPE (field))) + == REAL_TYPE))) && TARGET_FPU && ! packed_p && parms->named) { int this_slotno = parms->slotno + bitpos / BITS_PER_WORD; + int regno; + enum machine_mode mode = DECL_MODE (field); rtx reg; function_arg_record_value_3 (bitpos, parms); - - reg = gen_rtx_REG (DECL_MODE (field), - (SPARC_FP_ARG_FIRST + this_slotno * 2 - + (DECL_MODE (field) == SFmode - && (bitpos & 32) != 0))); + regno = SPARC_FP_ARG_FIRST + this_slotno * 2 + + ((mode == SFmode || mode == SCmode) + && (bitpos & 32) != 0); + switch (mode) + { + case SCmode: mode = SFmode; break; + case DCmode: mode = DFmode; break; + case TCmode: mode = TFmode; break; + default: break; + } + reg = gen_rtx_REG (mode, regno); XVECEXP (parms->ret, 0, parms->nregs) = gen_rtx_EXPR_LIST (VOIDmode, reg, GEN_INT (bitpos / BITS_PER_UNIT)); parms->nregs += 1; + if (TREE_CODE (TREE_TYPE (field)) == COMPLEX_TYPE) + { + regno += GET_MODE_SIZE (mode) / 4; + reg = gen_rtx_REG (mode, regno); + XVECEXP (parms->ret, 0, parms->nregs) + = gen_rtx_EXPR_LIST (VOIDmode, reg, + GEN_INT ((bitpos + GET_MODE_BITSIZE (mode)) + / BITS_PER_UNIT)); + parms->nregs += 1; + } } else { -- 2.7.4