This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] X86-64: Add -mskip-rax-setup
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Rasmus Villemoes <linux at rasmusvillemoes dot dk>, "x86 at kernel dot org" <x86 at kernel dot org>, Andi Kleen <andi at firstfloor dot org>, Ingo Molnar <mingo at redhat dot com>, "H. Peter Anvin" <hpa at zytor dot com>, Thomas Gleixner <tglx at linutronix dot de>
- Date: Thu, 18 Dec 2014 14:51:15 +0100
- Subject: Re: [PATCH] X86-64: Add -mskip-rax-setup
- Authentication-results: sourceware.org; auth=none
- References: <20141218131150 dot GA32638 at intel dot com> <CAFULd4ZaY5USX+CKdzoq1zWL8kZ3VqVx7KGxwb_tQEzbX03u-A at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Dec 18, 2014 at 02:24:06PM +0100, Uros Bizjak wrote:
> > It removed 14309 redundant "xor %eax,%eax" instructions and saved about
> > 27KB. I am currently running the new kernel without any problem. OK
> > for trunk?
>
> How about skipping RAX setup unconditionally for !TARGET_SSE? Please
> see ix86_conditional_register_usage, where SSE registers are squashed
> for !TARGET_SSE, so it is not possible to use them even in the inline
> asm.
I'd say a problem is if a -mno-sse TU calls a vararg function (obviously
it can't pass any float/double arguments) to a function in a TU compiled
with -msse2 or higher where the stdarg pass can't figure out anything, say
#include <stdarg.h>
extern void bar (int, va_list);
void
foo (int x, ...)
{
va_list ap;
va_start (ap, x);
bar (x, ap);
va_end (ap);
}
If foo is compiled with gcc 4.4 and earlier, it might crash when called from
-mno-sse caller that would not xor %eax,%eax. If foo is compiled with gcc
4.5? and higher, then it might just randomly save all the xmm registers to
stack (as the test is %al != 0, I think it will be more likely that it will
save it unnecessarily than not).
So I view H.J.'s new option as a user guarantee the callee will be also -mno-sse.
Jakub