This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PROPOSAL: Extend inline asm syntax with size spec
- From: Nadav Amit <namit at vmware dot com>
- To: Segher Boessenkool <segher at kernel dot crashing dot org>, Richard Biener <rguenther at suse dot de>
- Cc: Michael Matz <matz at suse dot de>, Borislav Petkov <bp at alien8 dot de>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, Ingo Molnar <mingo at redhat dot com>, LKML <linux-kernel at vger dot kernel dot org>, X86 ML <x86 at kernel dot org>, Masahiro Yamada <yamada dot masahiro at socionext dot com>, Sam Ravnborg <sam at ravnborg dot org>, Alok Kataria <akataria at vmware dot com>, Christopher Li <sparse at chrisli dot org>, Greg Kroah-Hartman <gregkh at linuxfoundation dot org>, "H. Peter Anvin" <hpa at zytor dot com>, Jan Beulich <JBeulich at suse dot com>, Josh Poimboeuf <jpoimboe at redhat dot com>, Juergen Gross <jgross at suse dot com>, Kate Stewart <kstewart at linuxfoundation dot org>, Kees Cook <keescook at chromium dot org>, "linux-sparse at vger dot kernel dot org" <linux-sparse at vger dot kernel dot org>, Peter Zijlstra <peterz at infradead dot org>, Philippe Ombredanne <pombredanne at nexb dot com>, Thomas Gleixner <tglx at linutronix dot de>, "virtualization at lists dot linux-foundation dot org" <virtualization at lists dot linux-foundation dot org>, Linus Torvalds <torvalds at linux-foundation dot org>, Chris Zankel <chris at zankel dot net>, Max Filippov <jcmvbkbc at gmail dot com>, "linux-xtensa at linux-xtensa dot org" <linux-xtensa at linux-xtensa dot org>
- Date: Wed, 10 Oct 2018 16:31:41 +0000
- Subject: Re: PROPOSAL: Extend inline asm syntax with size spec
- References: <20181003213100.189959-1-namit@vmware.com> <20181007091805.GA30687@zn.tnic> <20181007132228.GJ29268@gate.crashing.org> <alpine.LSU.2.21.1810071534220.7867@wotan.suse.de> <20181008073128.GL29268@gate.crashing.org> <alpine.LSU.2.20.1810081105350.16707@zhemvz.fhfr.qr> <20181009145330.GT29268@gate.crashing.org>
at 7:53 AM, Segher Boessenkool <segher@kernel.crashing.org> wrote:
> On Mon, Oct 08, 2018 at 11:07:46AM +0200, Richard Biener wrote:
>> On Mon, 8 Oct 2018, Segher Boessenkool wrote:
>>> On Sun, Oct 07, 2018 at 03:53:26PM +0000, Michael Matz wrote:
>>>> On Sun, 7 Oct 2018, Segher Boessenkool wrote:
>>>>> On Sun, Oct 07, 2018 at 11:18:06AM +0200, Borislav Petkov wrote:
>>>>>> Now, Richard suggested doing something like:
>>>>>>
>>>>>> 1) inline asm ("...")
>>>>>
>>>>> What would the semantics of this be?
>>>>
>>>> The size of the inline asm wouldn't be counted towards the inliner size
>>>> limits (or be counted as "1").
>>>
>>> That sounds like a good option.
>>
>> Yes, I also like it for simplicity. It also avoids the requirement
>> of translating the number (in bytes?) given by the user to
>> "number of GIMPLE instructions" as needed by the inliner.
>
> This patch implements this, for C only so far. And the syntax is
> "asm inline", which is more in line with other syntax.
>
> How does this look?
It looks good to me in general. I have a couple of reservations, but I
suspect you will not want to address them:
1. It is not backward compatible, requiring a C macro to wrap it, as the
kernel might be built with different compilers.
2. It is specific to asm. I do not have in mind another use case (excluding
the __builtin_constant_p), but it would be nicer IMHO to have a builtin
saying “ignore the cost of this statement” for the matter of optimizations.
Regards,
Nadav