On Fri, 12 Oct 2018, Segher Boessenkool wrote:

> The Linux kernel people want a feature that makes GCC pretend some
> inline assembler code is tiny (while it would think it is huge), so
> that such code will be inlined essentially always instead of
> essentially never.

I do apologize for being quite late for the party here, but given
that the main problem is too much of the asm body is accounted as
its cost, wouldn't it be cleaner to give asm writers a way to
write portions of asm template that GCC wouldn't count as its cost?

For instance by introducing special tokens like %[ %] that demarkate
portion of the asm that shouldn't be counted:

  asm (
   "mov r1, r2                              \
    %[                                      \
    .pushsection foo                        \
    %% this part is not counted as asm cost \
    ...                                     \
    ...                                     \ 
    .popsection                             \
    %]                                      \
    ");

The implementation on GCC side should be quite simple.

Alexander

Reply via email to