On Thu, Dec 18, 2014 at 5:51 AM, Jakub Jelinek <ja...@redhat.com> wrote: > 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
This was checked into GCC 4.4: commit d5d9458afdae9056a9624ae9c332dbcdc2f383be Author: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Tue Sep 2 19:49:41 2008 +0000 * config/i386/i386.c (X86_64_VARARGS_SIZE): Removed. (setup_incoming_varargs_64): Assume cum != NULL. Set/check ix86_varargs_gpr_size and ix86_varargs_fpr_size. Use ix86_varargs_gpr_size instead of X86_64_REGPARM_MAX. Don't set ix86_save_varrargs_registers. (ix86_setup_incoming_varargs): Assume cum != NULL. (ix86_va_start): Check ix86_varargs_gpr_size and ix86_varargs_fpr_size instead of cfun->va_list_gpr_size and cfun->va_list_fpr_size, respectively. Subtract 8*X86_64_REGPARM_MAX from frame pointer if ix86_varargs_gpr_size == 0. (ix86_compute_frame_layout): Updated. * config/i386/i386.h (ix86_save_varrargs_registers): Removed. (ix86_varargs_gpr_size): Define. (ix86_varargs_fpr_size): Likewise. (machine_function): Remove save_varrargs_registers. Add varargs_gpr_size and varargs_fpr_size. * gcc.target/i386/amd64-abi-3.c: New test. * gcc.target/i386/amd64-abi-4.c: Likewise. * gcc.target/i386/amd64-abi-5.c: Likewise. * gcc.target/i386/amd64-abi-6.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139910 138bc75d-0d04-0410-961f-82ee72b054a4 > -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 GCC 4.4 is fine. > 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. > If foo may be compiled by GCC 4.3 or older, we can't skip setting up RAX in foo's callers. Such an option is useful. -- H.J.