diff mbox series

[10/13] rs6000, extend vec_xxpermdi built-in for __int128 args

Message ID 7290ea32-9e2f-41f4-9436-ea427ffe791b@linux.ibm.com
State New
Headers show
Series rs6000, built-in cleanup patch series | expand

Commit Message

Carl Love April 19, 2024, 9:18 p.m. UTC
rs6000, extend vec_xxpermdi built-in for __int128 args

Add a new overloaded instance for vec_xxpermdi

   __int128 vec_xxpermdi (__int128, __int128, const int);

Update the documentation to include a reference to the new built-in
instance.

gcc/ChangeLog:
        * config/rs6000/rs6000-builtins.def (vec_xxpermdi): Add new
	overloaded built-in instance.
---
 gcc/config/rs6000/rs6000-overload.def | 2 ++
 gcc/doc/extend.texi                   | 1 +
 2 files changed, 3 insertions(+)

Comments

Kewen.Lin May 14, 2024, 5:14 a.m. UTC | #1
Hi,

on 2024/4/20 05:18, Carl Love wrote:
> rs6000, extend vec_xxpermdi built-in for __int128 args
> 
> Add a new overloaded instance for vec_xxpermdi
> 
>    __int128 vec_xxpermdi (__int128, __int128, const int);
> 
> Update the documentation to include a reference to the new built-in
> instance.
> 
> gcc/ChangeLog:
>         * config/rs6000/rs6000-builtins.def (vec_xxpermdi): Add new
> 	overloaded built-in instance.
> ---
>  gcc/config/rs6000/rs6000-overload.def | 2 ++
>  gcc/doc/extend.texi                   | 1 +
>  2 files changed, 3 insertions(+)
> 
> diff --git a/gcc/config/rs6000/rs6000-overload.def b/gcc/config/rs6000/rs6000-overload.def
> index 5912c9452f4..49962e2f2a2 100644
> --- a/gcc/config/rs6000/rs6000-overload.def
> +++ b/gcc/config/rs6000/rs6000-overload.def
> @@ -4932,6 +4932,8 @@
>      XXPERMDI_4SF  XXPERMDI_VF
>    vd __builtin_vsx_xxpermdi (vd, vd, const int);
>      XXPERMDI_2DF  XXPERMDI_VD
> +  vsq __builtin_vsx_xxpermdi (vsq, vsq, const int);
> +    XXPERMDI_1TI  XXPERMDI_1TI

This actually introduces the signed __int128, considering the other
existing ones, I think we want both signed and unsigned.

>  
>  [VEC_XXSLDWI, vec_xxsldwi, __builtin_vsx_xxsldwi]
>    vsc __builtin_vsx_xxsldwi (vsc, vsc, const int);
> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
> index 86b8e536dbe..47cf2f3bc8b 100644
> --- a/gcc/doc/extend.texi
> +++ b/gcc/doc/extend.texi
> @@ -22505,6 +22505,7 @@ void vec_vsx_st (vector bool char, int, vector bool char *);
>  void vec_vsx_st (vector bool char, int, unsigned char *);
>  void vec_vsx_st (vector bool char, int, signed char *);
>  
> +vector __int128 vec_xxpermdi (vector __int128, vector __int128, const int);
>  vector double vec_xxpermdi (vector double, vector double, const int);
>  vector float vec_xxpermdi (vector float, vector float, const int);

Nit: Considering the existing ones sorted by element size descending, I guess
it's better to move the above here (and with the explicit signed and unsigned).

And we need a test case for it as well?

BR,
Kewen

>  vector long long vec_xxpermdi (vector long long, vector long long, const int);
Carl Love May 24, 2024, 8:20 p.m. UTC | #2
On 5/13/24 22:14, Kewen.Lin wrote:
> Hi,
> 
> on 2024/4/20 05:18, Carl Love wrote:
>> rs6000, extend vec_xxpermdi built-in for __int128 args
>>
>> Add a new overloaded instance for vec_xxpermdi
>>
>>    __int128 vec_xxpermdi (__int128, __int128, const int);
>>
>> Update the documentation to include a reference to the new built-in
>> instance.
>>
>> gcc/ChangeLog:
>>         * config/rs6000/rs6000-builtins.def (vec_xxpermdi): Add new
>> 	overloaded built-in instance.
>> ---
>>  gcc/config/rs6000/rs6000-overload.def | 2 ++
>>  gcc/doc/extend.texi                   | 1 +
>>  2 files changed, 3 insertions(+)
>>
>> diff --git a/gcc/config/rs6000/rs6000-overload.def b/gcc/config/rs6000/rs6000-overload.def
>> index 5912c9452f4..49962e2f2a2 100644
>> --- a/gcc/config/rs6000/rs6000-overload.def
>> +++ b/gcc/config/rs6000/rs6000-overload.def
>> @@ -4932,6 +4932,8 @@
>>      XXPERMDI_4SF  XXPERMDI_VF
>>    vd __builtin_vsx_xxpermdi (vd, vd, const int);
>>      XXPERMDI_2DF  XXPERMDI_VD
>> +  vsq __builtin_vsx_xxpermdi (vsq, vsq, const int);
>> +    XXPERMDI_1TI  XXPERMDI_1TI
> 
> This actually introduces the signed __int128, considering the other
> existing ones, I think we want both signed and unsigned.

Added unsigned as well.

> 
>>  
>>  [VEC_XXSLDWI, vec_xxsldwi, __builtin_vsx_xxsldwi]
>>    vsc __builtin_vsx_xxsldwi (vsc, vsc, const int);
>> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
>> index 86b8e536dbe..47cf2f3bc8b 100644
>> --- a/gcc/doc/extend.texi
>> +++ b/gcc/doc/extend.texi
>> @@ -22505,6 +22505,7 @@ void vec_vsx_st (vector bool char, int, vector bool char *);
>>  void vec_vsx_st (vector bool char, int, unsigned char *);
>>  void vec_vsx_st (vector bool char, int, signed char *);
>>  
>> +vector __int128 vec_xxpermdi (vector __int128, vector __int128, const int);
>>  vector double vec_xxpermdi (vector double, vector double, const int);
>>  vector float vec_xxpermdi (vector float, vector float, const int);
> 
> Nit: Considering the existing ones sorted by element size descending, I guess
> it's better to move the above here (and with the explicit signed and unsigned).

OK, moved the new prototype down below the float prototype and added the unsigned prototype.
> 
> And we need a test case for it as well?
Yes, we need a test case for both.  Added a new runnable test file.

                   Carl
diff mbox series

Patch

diff --git a/gcc/config/rs6000/rs6000-overload.def b/gcc/config/rs6000/rs6000-overload.def
index 5912c9452f4..49962e2f2a2 100644
--- a/gcc/config/rs6000/rs6000-overload.def
+++ b/gcc/config/rs6000/rs6000-overload.def
@@ -4932,6 +4932,8 @@ 
     XXPERMDI_4SF  XXPERMDI_VF
   vd __builtin_vsx_xxpermdi (vd, vd, const int);
     XXPERMDI_2DF  XXPERMDI_VD
+  vsq __builtin_vsx_xxpermdi (vsq, vsq, const int);
+    XXPERMDI_1TI  XXPERMDI_1TI
 
 [VEC_XXSLDWI, vec_xxsldwi, __builtin_vsx_xxsldwi]
   vsc __builtin_vsx_xxsldwi (vsc, vsc, const int);
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 86b8e536dbe..47cf2f3bc8b 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -22505,6 +22505,7 @@  void vec_vsx_st (vector bool char, int, vector bool char *);
 void vec_vsx_st (vector bool char, int, unsigned char *);
 void vec_vsx_st (vector bool char, int, signed char *);
 
+vector __int128 vec_xxpermdi (vector __int128, vector __int128, const int);
 vector double vec_xxpermdi (vector double, vector double, const int);
 vector float vec_xxpermdi (vector float, vector float, const int);
 vector long long vec_xxpermdi (vector long long, vector long long, const int);