This is the mail archive of the
mailing list for the GCC project.
Re: x86: combined usage of "-Os -mregparm=3" leads to broken codes
- From: Bin Meng <bmeng dot cn at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Tue, 23 Sep 2014 17:11:18 +0800
- Subject: Re: x86: combined usage of "-Os -mregparm=3" leads to broken codes
- Authentication-results: sourceware.org; auth=none
- References: <CAEUhbmVXbgm2casiADDTCofgFMkf2oTS+gvBFn_Zx47WX4jWmg at mail dot gmail dot com> <CAFiYyc0dREkFU6tu0RqVEPYa-OsahOcWDvSHqSgLrVPThLNcQQ at mail dot gmail dot com> <CAEUhbmVKKMk7DCTxJcZ65Q76zJsk-4-0R6AOUmXGf+8YE2xphw at mail dot gmail dot com> <20140923083201 dot GJ17454 at tucnak dot redhat dot com>
On Tue, Sep 23, 2014 at 4:32 PM, Jakub Jelinek <email@example.com> wrote:
> You are doing a call in the inline-asm behind compiler's back, and
> some registers are call clobbered in the ABI. So, unless you call a very
> special function written in assembly that doesn't clobber those registers
> (basically, uses a custom calling convention), you need to tell the compiler
> that your inline-asm clobbers all call clobbered registers in the inline-asm
> pattern. That is not just about general purpose registers, but e.g.
> SSE registers or i387 registers are clobbered too.
Sorry I still don't get it. The inline-asm codes are put in the very end
of the test function just before return, so the clobbered registers are
not used by gcc. The %edx gets overwritten before the inline-asm block.
I just did a modification to the inline-asm codes to indicate to gcc that
%edx is clobbered, but it did not help.