diff options
author | H.J. Lu <hongjiu.lu@intel.com> | 2014-12-18 17:35:45 +0000 |
---|---|---|
committer | H.J. Lu <hjl@gcc.gnu.org> | 2014-12-18 09:35:45 -0800 |
commit | fbe575b652f5bdcc459f447a0e6f0e059996d4ef (patch) | |
tree | 7abe718095968d4646ff74e4b3831d0cae25c95b /gcc/doc | |
parent | 8448880117087e77aaf6bcfc4398f4b0442db1b1 (diff) | |
download | gcc-fbe575b652f5bdcc459f447a0e6f0e059996d4ef.zip gcc-fbe575b652f5bdcc459f447a0e6f0e059996d4ef.tar.gz gcc-fbe575b652f5bdcc459f447a0e6f0e059996d4ef.tar.bz2 |
X86-64: Add -mskip-rax-setup
The Linux kernel never passes floating point arguments around, vararg
functions or not. Hence no vector registers are ever used when calling a
vararg function. But gcc still dutifully emits an "xor %eax,%eax" before
each and every call of a vararg function. Since no callee use that for
anything, these instructions are redundant.
This patch adds the -mskip-rax-setup option to skip setting up RAX
register when SSE is disabled and there are no variable arguments passed
in vector registers. Since RAX register is used to avoid unnecessarily
saving vector registers on stack when passing variable arguments, the
impacts of this option are callees may waste some stack space, misbehave
or jump to a random location. GCC 4.4 or newer don't those issues,
regardless the RAX register value since they don't check the RAX register
value when SSE is disabled.
gcc/
* config/i386/i386.c (ix86_expand_call): Skip setting up RAX
register for -mskip-rax-setup when there are no parameters
passed in vector registers.
* config/i386/i386.opt (mskip-rax-setup): New option.
* doc/invoke.texi: Document -mskip-rax-setup.
gcc/testsuite/
* gcc.target/i386/amd64-abi-7.c: New tests.
* gcc.target/i386/amd64-abi-8.c: Likwise.
* gcc.target/i386/amd64-abi-9.c: Likwise.
From-SVN: r218870
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/invoke.texi | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 15068da..33a7ed2 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -16256,6 +16256,19 @@ the profiling functions as nops. This is useful when they should be patched in later dynamically. This is likely only useful together with @option{-mrecord-mcount}. +@item -mskip-rax-setup +@itemx -mno-skip-rax-setup +@opindex mskip-rax-setup +When generating code for the x86-64 architecture with SSE extensions +disabled, @option{-skip-rax-setup} can be used to skip setting up RAX +register when there are no variable arguments passed in vector registers. + +@strong{Warning:} Since RAX register is used to avoid unnecessarily +saving vector registers on stack when passing variable arguments, the +impacts of this option are callees may waste some stack space, +misbehave or jump to a random location. GCC 4.4 or newer don't have +those issues, regardless the RAX register value. + @item -m8bit-idiv @itemx -mno-8bit-idiv @opindex 8bit-idiv |