[v2,0/4] LoongArch: Add some floating-point operations

Message ID 20221109135329.952128-1-xry111@xry111.site
Headers
Series LoongArch: Add some floating-point operations |

Message

Xi Ruoyao Nov. 9, 2022, 1:53 p.m. UTC
  These patches allow to expand the following builtins to floating point
instructions for LoongArch:

- __builtin_rint{,f}
- __builtin_{l,ll}rint{,f}
- __builtin_{l,ll}floor{,f}
- __builtin_{l,ll}ceil{,f}
- __builtin_scalb{n,ln}{,f}
- __builtin_logb{,f}

Bootstrapped and regtested on loongarch64-linux-gnu.  And a modified
Glibc using the builtins for rint{,f}, {l,ll}rint{,f}, and logb{,f}
also survived Glibc test suite.

Please review ASAP because GCC 13 stage 1 will end on Nov. 13th.

v1 -> v2: Only use ftint{rm,rp} instructions if floor and ceil are
allowed to raise inexact exception.

Xi Ruoyao (4):
  LoongArch: Rename frint_<fmt> to rint<mode>2
  LoongArch: Add ftint{,rm,rp}.{w,l}.{s,d} instructions
  LoongArch: Add fscaleb.{s,d} instructions as ldexp{sf,df}3
  LoongArch: Add flogb.{s,d} instructions and expand logb{sf,df}2

 gcc/config/loongarch/loongarch.md             | 95 ++++++++++++++++++-
 gcc/testsuite/gcc.target/loongarch/flogb.c    | 18 ++++
 gcc/testsuite/gcc.target/loongarch/frint.c    | 16 ++++
 gcc/testsuite/gcc.target/loongarch/fscaleb.c  | 48 ++++++++++
 .../gcc.target/loongarch/ftint-no-inexact.c   | 44 +++++++++
 gcc/testsuite/gcc.target/loongarch/ftint.c    | 44 +++++++++
 6 files changed, 261 insertions(+), 4 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/loongarch/flogb.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/frint.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/fscaleb.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/ftint-no-inexact.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/ftint.c
  

Comments

Xi Ruoyao Nov. 12, 2022, 7:08 a.m. UTC | #1
On Wed, 2022-11-09 at 21:53 +0800, Xi Ruoyao wrote:
> These patches allow to expand the following builtins to floating point
> instructions for LoongArch:
> 
> - __builtin_rint{,f}
> - __builtin_{l,ll}rint{,f}
> - __builtin_{l,ll}floor{,f}
> - __builtin_{l,ll}ceil{,f}
> - __builtin_scalb{n,ln}{,f}
> - __builtin_logb{,f}
> 
> Bootstrapped and regtested on loongarch64-linux-gnu.  And a modified
> Glibc using the builtins for rint{,f}, {l,ll}rint{,f}, and logb{,f}
> also survived Glibc test suite.
> 
> Please review ASAP because GCC 13 stage 1 will end on Nov. 13th.
> 
> v1 -> v2: Only use ftint{rm,rp} instructions if floor and ceil are
> allowed to raise inexact exception.
> 
> Xi Ruoyao (4):
>   LoongArch: Rename frint_<fmt> to rint<mode>2
>   LoongArch: Add ftint{,rm,rp}.{w,l}.{s,d} instructions
>   LoongArch: Add fscaleb.{s,d} instructions as ldexp{sf,df}3
>   LoongArch: Add flogb.{s,d} instructions and expand logb{sf,df}2
> 
>  gcc/config/loongarch/loongarch.md             | 95
> ++++++++++++++++++-
>  gcc/testsuite/gcc.target/loongarch/flogb.c    | 18 ++++
>  gcc/testsuite/gcc.target/loongarch/frint.c    | 16 ++++
>  gcc/testsuite/gcc.target/loongarch/fscaleb.c  | 48 ++++++++++
>  .../gcc.target/loongarch/ftint-no-inexact.c   | 44 +++++++++
>  gcc/testsuite/gcc.target/loongarch/ftint.c    | 44 +++++++++
>  6 files changed, 261 insertions(+), 4 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.target/loongarch/flogb.c
>  create mode 100644 gcc/testsuite/gcc.target/loongarch/frint.c
>  create mode 100644 gcc/testsuite/gcc.target/loongarch/fscaleb.c
>  create mode 100644 gcc/testsuite/gcc.target/loongarch/ftint-no-
> inexact.c
>  create mode 100644 gcc/testsuite/gcc.target/loongarch/ftint.c
> 

Pushed r13-3922.

I'll be busy in the following week.  Will do the work on Glibc side
after Nov. 20.
  
chenglulu Nov. 12, 2022, 7:14 a.m. UTC | #2
在 2022/11/12 下午3:08, Xi Ruoyao 写道:
> On Wed, 2022-11-09 at 21:53 +0800, Xi Ruoyao wrote:
>> These patches allow to expand the following builtins to floating point
>> instructions for LoongArch:
>>
>> - __builtin_rint{,f}
>> - __builtin_{l,ll}rint{,f}
>> - __builtin_{l,ll}floor{,f}
>> - __builtin_{l,ll}ceil{,f}
>> - __builtin_scalb{n,ln}{,f}
>> - __builtin_logb{,f}
>>
>> Bootstrapped and regtested on loongarch64-linux-gnu.  And a modified
>> Glibc using the builtins for rint{,f}, {l,ll}rint{,f}, and logb{,f}
>> also survived Glibc test suite.
>>
>> Please review ASAP because GCC 13 stage 1 will end on Nov. 13th.
>>
>> v1 -> v2: Only use ftint{rm,rp} instructions if floor and ceil are
>> allowed to raise inexact exception.
>>
>> Xi Ruoyao (4):
>>    LoongArch: Rename frint_<fmt> to rint<mode>2
>>    LoongArch: Add ftint{,rm,rp}.{w,l}.{s,d} instructions
>>    LoongArch: Add fscaleb.{s,d} instructions as ldexp{sf,df}3
>>    LoongArch: Add flogb.{s,d} instructions and expand logb{sf,df}2
>>
>>   gcc/config/loongarch/loongarch.md             | 95
>> ++++++++++++++++++-
>>   gcc/testsuite/gcc.target/loongarch/flogb.c    | 18 ++++
>>   gcc/testsuite/gcc.target/loongarch/frint.c    | 16 ++++
>>   gcc/testsuite/gcc.target/loongarch/fscaleb.c  | 48 ++++++++++
>>   .../gcc.target/loongarch/ftint-no-inexact.c   | 44 +++++++++
>>   gcc/testsuite/gcc.target/loongarch/ftint.c    | 44 +++++++++
>>   6 files changed, 261 insertions(+), 4 deletions(-)
>>   create mode 100644 gcc/testsuite/gcc.target/loongarch/flogb.c
>>   create mode 100644 gcc/testsuite/gcc.target/loongarch/frint.c
>>   create mode 100644 gcc/testsuite/gcc.target/loongarch/fscaleb.c
>>   create mode 100644 gcc/testsuite/gcc.target/loongarch/ftint-no-
>> inexact.c
>>   create mode 100644 gcc/testsuite/gcc.target/loongarch/ftint.c
>>
> Pushed r13-3922.
>
> I'll be busy in the following week.  Will do the work on Glibc side
> after Nov. 20.
>
I will send the patch of prefetch later, please help to check it:-)
  
tangxiaolin Nov. 14, 2022, 2:41 a.m. UTC | #3
How about I do this work on Glibc?



在 2022/11/12 下午3:08, Xi Ruoyao 写道:
> On Wed, 2022-11-09 at 21:53 +0800, Xi Ruoyao wrote:
>> These patches allow to expand the following builtins to floating point
>> instructions for LoongArch:
>>
>> - __builtin_rint{,f}
>> - __builtin_{l,ll}rint{,f}
>> - __builtin_{l,ll}floor{,f}
>> - __builtin_{l,ll}ceil{,f}
>> - __builtin_scalb{n,ln}{,f}
>> - __builtin_logb{,f}
>>
>> Bootstrapped and regtested on loongarch64-linux-gnu.  And a modified
>> Glibc using the builtins for rint{,f}, {l,ll}rint{,f}, and logb{,f}
>> also survived Glibc test suite.
>>
>> Please review ASAP because GCC 13 stage 1 will end on Nov. 13th.
>>
>> v1 -> v2: Only use ftint{rm,rp} instructions if floor and ceil are
>> allowed to raise inexact exception.
>>
>> Xi Ruoyao (4):
>>    LoongArch: Rename frint_<fmt> to rint<mode>2
>>    LoongArch: Add ftint{,rm,rp}.{w,l}.{s,d} instructions
>>    LoongArch: Add fscaleb.{s,d} instructions as ldexp{sf,df}3
>>    LoongArch: Add flogb.{s,d} instructions and expand logb{sf,df}2
>>
>>   gcc/config/loongarch/loongarch.md             | 95
>> ++++++++++++++++++-
>>   gcc/testsuite/gcc.target/loongarch/flogb.c    | 18 ++++
>>   gcc/testsuite/gcc.target/loongarch/frint.c    | 16 ++++
>>   gcc/testsuite/gcc.target/loongarch/fscaleb.c  | 48 ++++++++++
>>   .../gcc.target/loongarch/ftint-no-inexact.c   | 44 +++++++++
>>   gcc/testsuite/gcc.target/loongarch/ftint.c    | 44 +++++++++
>>   6 files changed, 261 insertions(+), 4 deletions(-)
>>   create mode 100644 gcc/testsuite/gcc.target/loongarch/flogb.c
>>   create mode 100644 gcc/testsuite/gcc.target/loongarch/frint.c
>>   create mode 100644 gcc/testsuite/gcc.target/loongarch/fscaleb.c
>>   create mode 100644 gcc/testsuite/gcc.target/loongarch/ftint-no-
>> inexact.c
>>   create mode 100644 gcc/testsuite/gcc.target/loongarch/ftint.c
>>
> Pushed r13-3922.
>
> I'll be busy in the following week.  Will do the work on Glibc side
> after Nov. 20.
>