Re: PROPOSAL: Extend inline asm syntax with size spec

Segher Boessenkool
2018-10-10T21:57:49Z

Hi Nadav,

On Wed, Oct 10, 2018 at 04:31:41PM +0000, Nadav Amit wrote:
> at 7:53 AM, Segher Boessenkool <segher@kernel.crashing.org> wrote:
> > 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.

How *could* it be backward compatible? There should be an error or at least
a warning if the compiler does not support this, in general.

For the kernel, the kernel already has plenty of infrastructure to support
this (compiler.h etc.) For other applications it is quite trivial, too.

> 2. It is specific to asm.

Yes, and that is on purpose.

> 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.

That is a hundred or a thousand times more work to design and implement
(including testing etc.) I'm not going to do it, but feel free to try
yourself!

Segher