This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Don't allocate space for SSE reg in reg save area if SSE is disabled
- From: Jakub Jelinek <jakub at redhat dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org, ubizjak at gmail dot com, torvalds at linux-foundation dot org, jh at suse dot cz
- Date: Thu, 28 Aug 2008 13:23:24 -0400
- Subject: Re: PATCH: Don't allocate space for SSE reg in reg save area if SSE is disabled
- References: <20080828165745.GA26488@lucon.org> <20080828170449.GA1738@lucon.org>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Aug 28, 2008 at 10:04:49AM -0700, H.J. Lu wrote:
> On Thu, Aug 28, 2008 at 09:57:45AM -0700, H.J. Lu wrote:
> >
> > We are allocating space for SSE reg in reg save area even if SSE is
> > disabled. -mno-sse is used on Linux kernel. Here is patch to avoid it.
> > OK for trunk and 4.3?
> >
>
> Here is the updated patch with some optimization. OK for trunk and
> 4.3?
Does this actually work, even if e.g. there are no integer, but some
floating point va_args?
Say
double foo (int n, ...)
{
float ret = 0.0;
va_list ap;
va_start (ap, n);
for (int i = 0; i < n; i++)
ret += va_arg (ap, double);
va_end (ap);
return 0;
}
I'm afraid it would just clobber wrong portion of the stack.
E.g. setup_incoming_varargs_64 does:
emit_insn (gen_rtx_SET (VOIDmode, tmp_reg,
plus_constant (save_area,
8 * X86_64_REGPARM_MAX + 127)));
where I'd expect you want with your patch ix86_varargs_gpr_size + 127.
Similarly, ix86_va_start needs some changes too if the area for gpr
registers is left out. Either change:
t = build2 (MODIFY_EXPR, type, fpr,
build_int_cst (type, n_fpr * 16 + 8*X86_64_REGPARM_MAX));
- if ix86_varargs_gpr_size is zero, then supposedly va_list doesn't escape
and so we don't care about ABI effects. Or adjust ap.reg_save_area
initialization (sav) instead, if ix86_varargs_gpr_size is 0 subtract
8*X86_64_REGPARM_MAX from it.
Jakub