Re: [PATCH v2 4/6] compiler-gcc.h: add asm_inline definition

From: Segher Boessenkool
Date: Sat Sep 07 2019 - 09:11:56 EST


On Fri, Sep 06, 2019 at 06:04:54PM -0700, Nick Desaulniers wrote:
> On Fri, Sep 6, 2019 at 5:14 PM Segher Boessenkool
> <segher@xxxxxxxxxxxxxxxxxxx> wrote:
> > On Fri, Sep 06, 2019 at 04:42:58PM -0700, Nick Desaulniers via gcc-patches wrote:
> > > Just to prove my point about version checks being brittle, it looks
> > > like Rasmus' version check isn't even right. GCC supported `asm
> > > inline` back in the 8.3 release, not 9.1 as in this patch:
> >
> > Yes, I backported it so that it is available in 7.5, 8.3, and 9.1, so
> > that more users will have this available sooner. (7.5 has not been
> > released yet, but asm inline has been supported in GCC 7 since Jan 2
> > this year).
>
> Ah, ok that makes sense.
>
> How would you even write a version check for that?

I wouldn't. Please stop using that straw man. I'm not saying version
checks are good, or useful for most things. I am saying they are not.

Predefined compiler symbols to do version checking (of a feature) is
just a lesser instance of the same problem though. (And it causes its
own more or less obvious problems as well).

> > > Or was it "broken" until 9.1? Lord knows, as `asm inline` wasn't in
> > > any release notes or bug reports I can find:
> >
> > https://gcc.gnu.org/ml/gcc-patches/2019-02/msg01143.html
> >
> > It never was accepted, and I dropped the ball.
>
> Ah, ok, that's fine, so documentation was at least written. Tracking
> when and where patches land (or don't) is difficult when patch files
> are emailed around. I try to keep track of when and where our kernel
> patches land, but I frequently drop the ball there.

I keep track of most things just fine... But the release notes are part
of our web content, which is in a separate CVS repository (still nicer
than SVN :-) ), and since I don't use it very often it falls outside of
all my normal procedures.

> your preference). I'm already subscribed to more mailing lists than I
> have time to read.
>
> > But I'll try to remember, sure.
> > Not that I am involved in all such discussions myself, mind.
>
> But you _did_ implement `asm inline`. ;)

That started as just

+ /* If this asm is asm inline, count anything as minimum size. */
+ if (gimple_asm_inline_p (as_a <gasm *> (stmt)))
+ count = MIN (1, count);

(in estimate_num_insns) but then things ballooned. Like such things do.


Segher