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

2019-09-19 Thread Segher Boessenkool
On Thu, Sep 12, 2019 at 02:54:50PM -0700, Nick Desaulniers wrote: > I have seen instances where instruction selection fails to select the > appropriate way to branch when inline asm size is misjudged, resulting > in un-encodeable jumps (as in the branch target is too far to be > encoded in the

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

2019-09-12 Thread Rasmus Villemoes
On 12/09/2019 23.54, Nick Desaulniers wrote: > On Sat, Sep 7, 2019 at 6:11 AM Segher Boessenkool > wrote: >> >> On Fri, Sep 06, 2019 at 06:04:54PM -0700, Nick Desaulniers wrote: >> >>> How would you even write a version check for that? >> >> I wouldn't. Please stop using that straw man. I'm not

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

2019-09-12 Thread Nick Desaulniers
On Sat, Sep 7, 2019 at 6:11 AM Segher Boessenkool wrote: > > On Fri, Sep 06, 2019 at 06:04:54PM -0700, Nick Desaulniers wrote: > > On Fri, Sep 6, 2019 at 5:14 PM Segher Boessenkool > > wrote: > > > On Fri, Sep 06, 2019 at 04:42:58PM -0700, Nick Desaulniers via > > > gcc-patches wrote: > > > >

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

2019-09-08 Thread Miguel Ojeda
On Sat, Sep 7, 2019 at 3:11 PM Segher Boessenkool wrote: > > 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

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

2019-09-07 Thread Segher Boessenkool
On Fri, Sep 06, 2019 at 06:04:54PM -0700, Nick Desaulniers wrote: > On Fri, Sep 6, 2019 at 5:14 PM Segher Boessenkool > 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 > > >

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

2019-09-06 Thread Nick Desaulniers via gcc-patches
On Fri, Sep 6, 2019 at 5:14 PM Segher Boessenkool 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 > >

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

2019-09-06 Thread Segher Boessenkool
On Fri, Sep 06, 2019 at 04:42:58PM -0700, Nick Desaulniers via gcc-patches wrote: > On Fri, Sep 6, 2019 at 3:56 PM Segher Boessenkool > wrote: > Oh, I misunderstood. I see your point. Define the symbol as a number > for what level of output flags you support (ie. the __cplusplus > macro).

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

2019-09-06 Thread Nick Desaulniers
On Fri, Sep 6, 2019 at 3:56 PM Segher Boessenkool wrote: > > On Fri, Sep 06, 2019 at 03:35:02PM -0700, Nick Desaulniers wrote: > > On Fri, Sep 6, 2019 at 3:03 PM Segher Boessenkool > > wrote: > > > And if instead you tested whether the actual feature you need works as > > > you need it to, it

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

2019-09-06 Thread Segher Boessenkool
On Fri, Sep 06, 2019 at 03:35:02PM -0700, Nick Desaulniers wrote: > On Fri, Sep 6, 2019 at 3:03 PM Segher Boessenkool > wrote: > > And if instead you tested whether the actual feature you need works as > > you need it to, it would even work fine if there was a bug we fixed that > > breaks things

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

2019-09-06 Thread Nick Desaulniers via gcc-patches
On Fri, Sep 6, 2019 at 3:03 PM Segher Boessenkool wrote: > > On Fri, Sep 06, 2019 at 11:14:08AM -0700, Nick Desaulniers wrote: > > Here's the case that I think is perfect: > > https://developers.redhat.com/blog/2016/02/25/new-asm-flags-feature-for-x86-in-gcc-6/ > > > > Specifically the feature

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

2019-09-06 Thread Segher Boessenkool
On Fri, Sep 06, 2019 at 11:14:08AM -0700, Nick Desaulniers wrote: > Here's the case that I think is perfect: > https://developers.redhat.com/blog/2016/02/25/new-asm-flags-feature-for-x86-in-gcc-6/ > > Specifically the feature test preprocessor define __GCC_ASM_FLAG_OUTPUTS__. > > See exactly how

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

2019-09-06 Thread Nick Desaulniers
On Fri, Sep 6, 2019 at 9:39 AM Jakub Jelinek wrote: > > On Fri, Sep 06, 2019 at 11:30:28AM -0500, Segher Boessenkool wrote: > > On Fri, Sep 06, 2019 at 05:13:54PM +0200, Miguel Ojeda wrote: > > > On Fri, Sep 6, 2019 at 2:23 PM Segher Boessenkool > > > wrote: > > > > I can't find anything with

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

2019-09-06 Thread Miguel Ojeda
On Fri, Sep 6, 2019 at 6:30 PM Segher Boessenkool wrote: > > (Which isn't the C++ standard yet, okay). At this stage, it pretty much is. It is basically bug fixing at this point. > No, that is not what it does. A user defines such a macro, and that > makes the library change behaviour. That

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

2019-09-06 Thread Jakub Jelinek
On Fri, Sep 06, 2019 at 11:30:28AM -0500, Segher Boessenkool wrote: > On Fri, Sep 06, 2019 at 05:13:54PM +0200, Miguel Ojeda wrote: > > On Fri, Sep 6, 2019 at 2:23 PM Segher Boessenkool > > wrote: > > > I can't find anything with "feature" and "macros" in the C++ standard, > > > it's "predefined

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

2019-09-06 Thread Segher Boessenkool
On Fri, Sep 06, 2019 at 05:13:54PM +0200, Miguel Ojeda wrote: > On Fri, Sep 6, 2019 at 2:23 PM Segher Boessenkool > wrote: > > I can't find anything with "feature" and "macros" in the C++ standard, > > it's "predefined macros" there I guess? In C, it is also "predefined > > macros" in general,

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

2019-09-06 Thread Miguel Ojeda
On Fri, Sep 6, 2019 at 2:23 PM Segher Boessenkool wrote: > > I can't find anything with "feature" and "macros" in the C++ standard, > it's "predefined macros" there I guess? In C, it is also "predefined > macros" in general, and there is "conditional feature macros". They are introduced in

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

2019-09-06 Thread Segher Boessenkool
On Thu, Sep 05, 2019 at 05:52:44PM +0200, Miguel Ojeda wrote: > On Thu, Sep 5, 2019 at 3:45 PM Segher Boessenkool > wrote: > > > > [ That's not what a feature test macro is; a feature test macro allows the > > user to select some optional behaviour. Things like _GNU_SOURCE. ] > > Yes and no.

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

2019-09-05 Thread Miguel Ojeda
On Thu, Sep 5, 2019 at 5:52 PM Miguel Ojeda wrote: > > Yes and no. GNU libc defines feature test macros like you say, but > C++'s feature macros are like Rasmus/Nick are saying. I think libc's > definition is weird, I would call those "feature selection macros" > instead, because the user is

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

2019-09-05 Thread Miguel Ojeda
On Thu, Sep 5, 2019 at 3:45 PM Segher Boessenkool wrote: > > [ That's not what a feature test macro is; a feature test macro allows the > user to select some optional behaviour. Things like _GNU_SOURCE. ] Yes and no. GNU libc defines feature test macros like you say, but C++'s feature macros

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

2019-09-05 Thread Segher Boessenkool
On Thu, Sep 05, 2019 at 04:23:11PM +0200, Rasmus Villemoes wrote: > On 05/09/2019 15.45, Segher Boessenkool wrote: > > On Thu, Sep 05, 2019 at 01:07:11PM +0200, Rasmus Villemoes wrote: > >> Perhaps something like below, though that > >> won't affect the already released gcc 9.1 and 9.2, of course.

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

2019-09-05 Thread Rasmus Villemoes
On 05/09/2019 15.45, Segher Boessenkool wrote: > Hi Rasmus, > > On Thu, Sep 05, 2019 at 01:07:11PM +0200, Rasmus Villemoes wrote: >> On 05/09/2019 02.18, Nick Desaulniers wrote: >>> Is it too late to ask for a feature test macro? Maybe one already >>> exists? >> >> No, not as far as I know. > >

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

2019-09-05 Thread Segher Boessenkool
Hi Rasmus, On Thu, Sep 05, 2019 at 01:07:11PM +0200, Rasmus Villemoes wrote: > On 05/09/2019 02.18, Nick Desaulniers wrote: > > Is it too late to ask for a feature test macro? Maybe one already > > exists? > > No, not as far as I know. [ That's not what a feature test macro is; a feature test

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

2019-09-05 Thread Rasmus Villemoes
On 05/09/2019 02.18, Nick Desaulniers wrote: > On Fri, Aug 30, 2019 at 4:15 PM Rasmus Villemoes > wrote: >> >> This adds an asm_inline macro which expands to "asm inline" [1] when gcc >> is new enough (>= 9.1), and just asm for older gccs and other >> compilers. >> >> Signed-off-by: Rasmus