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: Richard Biener <richard dot guenther at gmail dot com>
- To: Andrew Haley <aph at redhat dot com>
- Cc: Bin Meng <bmeng dot cn at gmail dot com>, Jakub Jelinek <jakub at redhat dot com>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Tue, 23 Sep 2014 12:49:40 +0200
- 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> <CAEUhbmWBB=WM7VsoGAcvVGho5CA8ee+HCj=pMKBC7yUpXkvQZA at mail dot gmail dot com> <54214E57 dot 7080304 at redhat dot com>
On Tue, Sep 23, 2014 at 12:41 PM, Andrew Haley <email@example.com> wrote:
> On 09/23/2014 10:39 AM, Bin Meng wrote:
>> On Tue, Sep 23, 2014 at 5:11 PM, Bin Meng <firstname.lastname@example.org> 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.
> And neither are they used by the asm; so you have no right to expect %edx
> to contain anything, and neither have you the right to touch it.
> Do this:
> asm volatile (
> "pushl %1;"
> "call *%%eax;"
> "addl $4, %%esp;"
> : "=a"(status) : "m"(params_ptr), "a"(pcall), "d"(d)
I suppose doing "m" (*params_ptr) would also work.
> "If you lie to the compiler, it will get its revenge." -- Henry Spencer