Message ID | 20220831181443.3875972-1-adhemerval.zanella@linaro.org |
---|---|
State | New |
Headers | show |
Series | math: x86: Remove extra '%' on FP_INIT_ROUNDMODE inline asm | expand |
On Wed, Aug 31, 2022 at 11:16 AM Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org> wrote: > > Checked on x86_64-linux-gnu. > --- > sysdeps/x86/fpu/sfp-machine.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sysdeps/x86/fpu/sfp-machine.h b/sysdeps/x86/fpu/sfp-machine.h > index 5892f4f5fe..1cacdb4ebd 100644 > --- a/sysdeps/x86/fpu/sfp-machine.h > +++ b/sysdeps/x86/fpu/sfp-machine.h > @@ -41,7 +41,7 @@ typedef unsigned int UTItype __attribute__ ((mode (TI))); > > # define FP_INIT_ROUNDMODE \ > do { \ > - __asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (_fcw)); \ > + __asm__ __volatile__ ("vstmxcsr\t%0" : "=m" (_fcw)); \ > } while (0) > #else > # define _FP_W_TYPE_SIZE 32 > -- > 2.34.1 > The intention was to generate stmxcsr with SSE and vstmxcsr with AVX. I think we should define a special prefix, like AVX_INSN_PREFIX, which is 'v' if __AVX__ is defined and empty if __AVX__ isn't defined.
On Wed, 31 Aug 2022, Adhemerval Zanella via Libc-alpha wrote: > Checked on x86_64-linux-gnu. > --- > sysdeps/x86/fpu/sfp-machine.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sysdeps/x86/fpu/sfp-machine.h b/sysdeps/x86/fpu/sfp-machine.h > index 5892f4f5fe..1cacdb4ebd 100644 > --- a/sysdeps/x86/fpu/sfp-machine.h > +++ b/sysdeps/x86/fpu/sfp-machine.h > @@ -41,7 +41,7 @@ typedef unsigned int UTItype __attribute__ ((mode (TI))); > > # define FP_INIT_ROUNDMODE \ > do { \ > - __asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (_fcw)); \ > + __asm__ __volatile__ ("vstmxcsr\t%0" : "=m" (_fcw)); \ That's incorrect. %v means "'v' if AVX, empty string otherwise".
On 31/08/22 16:33, H.J. Lu wrote: > On Wed, Aug 31, 2022 at 11:16 AM Adhemerval Zanella via Libc-alpha > <libc-alpha@sourceware.org> wrote: >> >> Checked on x86_64-linux-gnu. >> --- >> sysdeps/x86/fpu/sfp-machine.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/sysdeps/x86/fpu/sfp-machine.h b/sysdeps/x86/fpu/sfp-machine.h >> index 5892f4f5fe..1cacdb4ebd 100644 >> --- a/sysdeps/x86/fpu/sfp-machine.h >> +++ b/sysdeps/x86/fpu/sfp-machine.h >> @@ -41,7 +41,7 @@ typedef unsigned int UTItype __attribute__ ((mode (TI))); >> >> # define FP_INIT_ROUNDMODE \ >> do { \ >> - __asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (_fcw)); \ >> + __asm__ __volatile__ ("vstmxcsr\t%0" : "=m" (_fcw)); \ >> } while (0) >> #else >> # define _FP_W_TYPE_SIZE 32 >> -- >> 2.34.1 >> > > The intention was to generate stmxcsr with SSE and vstmxcsr with > AVX. I think we should define a special prefix, like AVX_INSN_PREFIX, > which is 'v' if __AVX__ is defined and empty if __AVX__ isn't defined. > Right, I was not aware of it. Is is documented on gcc inline assembly manual somewhere (I could not find it)? In any case I will follow your suggestion.
On Thu, Sep 1, 2022 at 6:01 AM Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> wrote: > > > > On 31/08/22 16:33, H.J. Lu wrote: > > On Wed, Aug 31, 2022 at 11:16 AM Adhemerval Zanella via Libc-alpha > > <libc-alpha@sourceware.org> wrote: > >> > >> Checked on x86_64-linux-gnu. > >> --- > >> sysdeps/x86/fpu/sfp-machine.h | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/sysdeps/x86/fpu/sfp-machine.h b/sysdeps/x86/fpu/sfp-machine.h > >> index 5892f4f5fe..1cacdb4ebd 100644 > >> --- a/sysdeps/x86/fpu/sfp-machine.h > >> +++ b/sysdeps/x86/fpu/sfp-machine.h > >> @@ -41,7 +41,7 @@ typedef unsigned int UTItype __attribute__ ((mode (TI))); > >> > >> # define FP_INIT_ROUNDMODE \ > >> do { \ > >> - __asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (_fcw)); \ > >> + __asm__ __volatile__ ("vstmxcsr\t%0" : "=m" (_fcw)); \ > >> } while (0) > >> #else > >> # define _FP_W_TYPE_SIZE 32 > >> -- > >> 2.34.1 > >> > > > > The intention was to generate stmxcsr with SSE and vstmxcsr with > > AVX. I think we should define a special prefix, like AVX_INSN_PREFIX, > > which is 'v' if __AVX__ is defined and empty if __AVX__ isn't defined. > > > > Right, I was not aware of it. Is is documented on gcc inline assembly I need to take a look. > manual somewhere (I could not find it)? In any case I will follow your > suggestion. There is no need for it. %v is handled by compiler with an operand.
On 01/09/22 11:51, H.J. Lu wrote: > On Thu, Sep 1, 2022 at 6:01 AM Adhemerval Zanella Netto > <adhemerval.zanella@linaro.org> wrote: >> >> >> >> On 31/08/22 16:33, H.J. Lu wrote: >>> On Wed, Aug 31, 2022 at 11:16 AM Adhemerval Zanella via Libc-alpha >>> <libc-alpha@sourceware.org> wrote: >>>> >>>> Checked on x86_64-linux-gnu. >>>> --- >>>> sysdeps/x86/fpu/sfp-machine.h | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/sysdeps/x86/fpu/sfp-machine.h b/sysdeps/x86/fpu/sfp-machine.h >>>> index 5892f4f5fe..1cacdb4ebd 100644 >>>> --- a/sysdeps/x86/fpu/sfp-machine.h >>>> +++ b/sysdeps/x86/fpu/sfp-machine.h >>>> @@ -41,7 +41,7 @@ typedef unsigned int UTItype __attribute__ ((mode (TI))); >>>> >>>> # define FP_INIT_ROUNDMODE \ >>>> do { \ >>>> - __asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (_fcw)); \ >>>> + __asm__ __volatile__ ("vstmxcsr\t%0" : "=m" (_fcw)); \ >>>> } while (0) >>>> #else >>>> # define _FP_W_TYPE_SIZE 32 >>>> -- >>>> 2.34.1 >>>> >>> >>> The intention was to generate stmxcsr with SSE and vstmxcsr with >>> AVX. I think we should define a special prefix, like AVX_INSN_PREFIX, >>> which is 'v' if __AVX__ is defined and empty if __AVX__ isn't defined. >>> >> >> Right, I was not aware of it. Is is documented on gcc inline assembly > > I need to take a look. Thanks. > >> manual somewhere (I could not find it)? In any case I will follow your >> suggestion. > > There is no need for it. %v is handled by compiler with an operand. Not by all compilers in fact, that's why I proposing the change.
On Thu, Sep 1, 2022 at 8:23 AM Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> wrote: > > > > On 01/09/22 11:51, H.J. Lu wrote: > > On Thu, Sep 1, 2022 at 6:01 AM Adhemerval Zanella Netto > > <adhemerval.zanella@linaro.org> wrote: > >> > >> > >> > >> On 31/08/22 16:33, H.J. Lu wrote: > >>> On Wed, Aug 31, 2022 at 11:16 AM Adhemerval Zanella via Libc-alpha > >>> <libc-alpha@sourceware.org> wrote: > >>>> > >>>> Checked on x86_64-linux-gnu. > >>>> --- > >>>> sysdeps/x86/fpu/sfp-machine.h | 2 +- > >>>> 1 file changed, 1 insertion(+), 1 deletion(-) > >>>> > >>>> diff --git a/sysdeps/x86/fpu/sfp-machine.h b/sysdeps/x86/fpu/sfp-machine.h > >>>> index 5892f4f5fe..1cacdb4ebd 100644 > >>>> --- a/sysdeps/x86/fpu/sfp-machine.h > >>>> +++ b/sysdeps/x86/fpu/sfp-machine.h > >>>> @@ -41,7 +41,7 @@ typedef unsigned int UTItype __attribute__ ((mode (TI))); > >>>> > >>>> # define FP_INIT_ROUNDMODE \ > >>>> do { \ > >>>> - __asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (_fcw)); \ > >>>> + __asm__ __volatile__ ("vstmxcsr\t%0" : "=m" (_fcw)); \ > >>>> } while (0) > >>>> #else > >>>> # define _FP_W_TYPE_SIZE 32 > >>>> -- > >>>> 2.34.1 > >>>> > >>> > >>> The intention was to generate stmxcsr with SSE and vstmxcsr with > >>> AVX. I think we should define a special prefix, like AVX_INSN_PREFIX, > >>> which is 'v' if __AVX__ is defined and empty if __AVX__ isn't defined. > >>> > >> > >> Right, I was not aware of it. Is is documented on gcc inline assembly > > > > I need to take a look. > > Thanks. > > > > >> manual somewhere (I could not find it)? In any case I will follow your > >> suggestion. > > > > There is no need for it. %v is handled by compiler with an operand. > > Not by all compilers in fact, that's why I proposing the change. Then my scheme should work.
diff --git a/sysdeps/x86/fpu/sfp-machine.h b/sysdeps/x86/fpu/sfp-machine.h index 5892f4f5fe..1cacdb4ebd 100644 --- a/sysdeps/x86/fpu/sfp-machine.h +++ b/sysdeps/x86/fpu/sfp-machine.h @@ -41,7 +41,7 @@ typedef unsigned int UTItype __attribute__ ((mode (TI))); # define FP_INIT_ROUNDMODE \ do { \ - __asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (_fcw)); \ + __asm__ __volatile__ ("vstmxcsr\t%0" : "=m" (_fcw)); \ } while (0) #else # define _FP_W_TYPE_SIZE 32