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:39:34 +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> <CAEUhbmVK0SwySVRf6Z+SUjPu7uaooB4ktckZjC0aUqHSmoiH1A at mail dot gmail dot com>
On Tue, Sep 23, 2014 at 5:11 PM, Bin Meng <email@example.com> wrote:
> 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.
PS: if turning on WORKAROUND define in my test code, the generated codes
I believe the issue is not with the inline assembly constraints but with
'-Os' plus '-regparm=3' combination. With '-Os' gcc optimization goes too
far to generate nothing for the C code 'params.a = d;' and gcc simply
takes %edx (supposed to be the 2nd parameter of test function) for a