This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: x86: combined usage of "-Os -mregparm=3" leads to broken codes

On Tue, Sep 23, 2014 at 11:39 AM, Bin Meng <> wrote:
> On Tue, Sep 23, 2014 at 5:11 PM, Bin Meng <> 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
> are correct.
> 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
> scratch register.

Well, you don't use 'params'.  the "m" (params_ptr) constraint only
puts the pointer in memory, it doesn't make the pointed-to value


> Regards,
> Bin

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]