public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] math: x86: Remove extra '%' on FP_INIT_ROUNDMODE inline asm
@ 2022-08-31 18:14 Adhemerval Zanella
  2022-08-31 19:33 ` H.J. Lu
  2022-08-31 19:35 ` Joseph Myers
  0 siblings, 2 replies; 7+ messages in thread
From: Adhemerval Zanella @ 2022-08-31 18:14 UTC (permalink / raw)
  To: libc-alpha

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] math: x86: Remove extra '%' on FP_INIT_ROUNDMODE inline asm
  2022-08-31 18:14 [PATCH] math: x86: Remove extra '%' on FP_INIT_ROUNDMODE inline asm Adhemerval Zanella
@ 2022-08-31 19:33 ` H.J. Lu
  2022-09-01 13:01   ` Adhemerval Zanella Netto
  2022-08-31 19:35 ` Joseph Myers
  1 sibling, 1 reply; 7+ messages in thread
From: H.J. Lu @ 2022-08-31 19:33 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

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.

-- 
H.J.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] math: x86: Remove extra '%' on FP_INIT_ROUNDMODE inline asm
  2022-08-31 18:14 [PATCH] math: x86: Remove extra '%' on FP_INIT_ROUNDMODE inline asm Adhemerval Zanella
  2022-08-31 19:33 ` H.J. Lu
@ 2022-08-31 19:35 ` Joseph Myers
  1 sibling, 0 replies; 7+ messages in thread
From: Joseph Myers @ 2022-08-31 19:35 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

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

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] math: x86: Remove extra '%' on FP_INIT_ROUNDMODE inline asm
  2022-08-31 19:33 ` H.J. Lu
@ 2022-09-01 13:01   ` Adhemerval Zanella Netto
  2022-09-01 14:51     ` H.J. Lu
  0 siblings, 1 reply; 7+ messages in thread
From: Adhemerval Zanella Netto @ 2022-09-01 13:01 UTC (permalink / raw)
  To: H.J. Lu, joseph_myers; +Cc: libc-alpha



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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] math: x86: Remove extra '%' on FP_INIT_ROUNDMODE inline asm
  2022-09-01 13:01   ` Adhemerval Zanella Netto
@ 2022-09-01 14:51     ` H.J. Lu
  2022-09-01 15:21       ` Adhemerval Zanella Netto
  0 siblings, 1 reply; 7+ messages in thread
From: H.J. Lu @ 2022-09-01 14:51 UTC (permalink / raw)
  To: Adhemerval Zanella Netto; +Cc: joseph_myers, GNU C Library

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.

-- 
H.J.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] math: x86: Remove extra '%' on FP_INIT_ROUNDMODE inline asm
  2022-09-01 14:51     ` H.J. Lu
@ 2022-09-01 15:21       ` Adhemerval Zanella Netto
  2022-09-01 16:26         ` H.J. Lu
  0 siblings, 1 reply; 7+ messages in thread
From: Adhemerval Zanella Netto @ 2022-09-01 15:21 UTC (permalink / raw)
  To: H.J. Lu; +Cc: joseph_myers, GNU C Library



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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] math: x86: Remove extra '%' on FP_INIT_ROUNDMODE inline asm
  2022-09-01 15:21       ` Adhemerval Zanella Netto
@ 2022-09-01 16:26         ` H.J. Lu
  0 siblings, 0 replies; 7+ messages in thread
From: H.J. Lu @ 2022-09-01 16:26 UTC (permalink / raw)
  To: Adhemerval Zanella Netto; +Cc: joseph_myers, GNU C Library

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.


-- 
H.J.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-09-01 16:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-31 18:14 [PATCH] math: x86: Remove extra '%' on FP_INIT_ROUNDMODE inline asm Adhemerval Zanella
2022-08-31 19:33 ` H.J. Lu
2022-09-01 13:01   ` Adhemerval Zanella Netto
2022-09-01 14:51     ` H.J. Lu
2022-09-01 15:21       ` Adhemerval Zanella Netto
2022-09-01 16:26         ` H.J. Lu
2022-08-31 19:35 ` Joseph Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).