This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] X86-64: Add -mskip-rax-setup


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]