diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2014-12-17 15:16:17 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2014-12-18 05:21:53 -0800 |
commit | 72345ebb4922b2bf38326dd64692e82dc1d58dd4 (patch) | |
tree | 528d50cbcbe561eb7eeb5cec92ada99df6583587 /gcc/config/i386/i386.opt | |
parent | f65f51011942090e77fee81d5217b6918143641b (diff) | |
download | gcc-hjl/skip-rax/gcc-4_8-branch.tar.gz |
X86-64: Add -mskip-rax-setuphjl/skip-rax/gcc-4_8-branch
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.
Diffstat (limited to 'gcc/config/i386/i386.opt')
-rw-r--r-- | gcc/config/i386/i386.opt | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt index 084a2486353..59a2695b3cd 100644 --- a/gcc/config/i386/i386.opt +++ b/gcc/config/i386/i386.opt @@ -611,6 +611,10 @@ mfentry Target Report Var(flag_fentry) Init(-1) Emit profiling counter call at function entry before prologue. +mskip-rax-setup +Target Report Var(flag_skip_rax_setup) Init(0) +Skip setting up RAX register when passing variable arguments. + m8bit-idiv Target Report Mask(USE_8BIT_IDIV) Save Expand 32bit/64bit integer divide into 8bit unsigned integer divide with run-time check |