public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Carl Love <cel@linux.ibm.com>
To: "Kewen.Lin" <linkw@linux.ibm.com>, Carl Love <cel@linux.ibm.com>
Cc: gcc-patches@gcc.gnu.org,
	Segher Boessenkool <segher@kernel.crashing.org>,
	"bergner@linux.ibm.com" <bergner@linux.ibm.com>
Subject: Re: [PATCH 13/13 ver 3] rs6000, remove vector set and vector init built-ins.
Date: Thu, 13 Jun 2024 08:35:37 -0700	[thread overview]
Message-ID: <9c551899-7259-4dea-a8d0-5b461f285488@linux.ibm.com> (raw)
In-Reply-To: <1d2f127a-5bcc-8b6c-ffe3-3125e92be9a6@linux.ibm.com>

Kewen:

On 6/3/24 22:59, Kewen.Lin wrote:
> Hi,
> 
> on 2024/5/30 00:16, Carl Love wrote:
>> This was patch 13 from the previous series.  Note the previous series patch 12 was dropped.  This patch is the same as the previous version.  The additional work to remove  __builtin_vec_set_v1ti, __builtin_vec_set_v2di,  __builtin_vec_set_v2d per the feedback comments with equivalent gimple code is being deferred to a future patch.  The goal of this series was simply to remove duplicated built-ins, extending overloaded built-ins as needed.  Adding the needed gimple code to remove the additional built-ins is beyond the goal of this patch series.
>>
>>                              Carl 
>> -------------------------------------------------------
>>
>> rs6000, remove vector set and vector init built-ins.
>>
>> The vector init built-ins:
>>
>>   __builtin_vec_init_v16qi, __builtin_vec_init_v8hi,
>>   __builtin_vec_init_v4si, __builtin_vec_init_v4sf,
>>   __builtin_vec_init_v2di, __builtin_vec_init_v2df,
>>   __builtin_vec_set_v1ti
> 
> Typo here, s/__builtin_vec_set_v1ti/__builtin_vec_init_v1ti/

Fixed.

> 
>>
>> perform the same operation as initializing the vector in C code.  For
>> example:
>>
>>   result_v4si = __builtin_vec_init_v4si (1, 2, 3, 4);
>>   result_v4si = {1, 2, 3, 4};
>>
>> These two constructs were tested and verified they generate identical
>> assembly instructions with no optimization and -O3 optimization.
>>
>> The vector set built-ins:
>>
>>   __builtin_vec_set_v16qi, __builtin_vec_set_v8hi.
>>   __builtin_vec_set_v4si, __builtin_vec_set_v4sf
> 
> Please also add the reserved ones (...v1ti/v2di/v2df), as they are the 
> same too, temporarily reserving them for the uses in resolve_vec_insert()
> doesn't affect this.

Added the three additional built-ins to the list.

> 
>>
>> perform the same operation as setting a specific element in the vector in
>> C code.  For example:
>>
>>   src_v4si = __builtin_vec_set_v4si (src_v4si, int_val, index);
>>   src_v4si[index] = int_val;
>>
>> The built-in actually generates more instructions than the inline C code
>> with no optimization but is identical with -O3 optimizations.
>>
>> All of the above built-ins that are removed do not have test cases and
>> are not documented.
>>
>> Built-ins   __builtin_vec_set_v1ti __builtin_vec_set_v2di,
>> __builtin_vec_set_v2df are not removed as they are used in function
>> resolve_vec_insert() in file rs6000-c.cc.
>>
>> The built-ins are removed as they don't provide any benefit over just
>> using C code.
>>
>> gcc/ChangeLog:
>> 	* config/rs6000/rs6000-builtins.def (__builtin_vec_init_v16qi,
>> 	__builtin_vec_init_v8hi, __builtin_vec_init_v4si,
>> 	__builtin_vec_init_v4sf, __builtin_vec_init_v2di,
>> 	__builtin_vec_init_v2df, __builtin_vec_set_v1ti,
> 
> Typo, s/__builtin_vec_set_v1ti/__builtin_vec_init_v1ti/

Fixed

> 
>> 	__builtin_vec_set_v16qi, __builtin_vec_set_v8hi.
>> 	__builtin_vec_set_v4si, __builtin_vec_set_v4sf,
>> 	__builtin_vec_set_v2di, __builtin_vec_set_v2df,
>> 	__builtin_vec_set_v1ti): Remove built-in definitions.
> 
> The last three ones are not actually removed.

OK, fixed.

> 
>> ---
>>  gcc/config/rs6000/rs6000-builtins.def | 42 ++-------------------------
>>  1 file changed, 2 insertions(+), 40 deletions(-)
>>
>> diff --git a/gcc/config/rs6000/rs6000-builtins.def b/gcc/config/rs6000/rs6000-builtins.def
>> index 48ebc018a8d..8349d45169f 100644
>> --- a/gcc/config/rs6000/rs6000-builtins.def
>> +++ b/gcc/config/rs6000/rs6000-builtins.def
>> @@ -1118,37 +1118,6 @@
>>    const signed short __builtin_vec_ext_v8hi (vss, signed int);
>>      VEC_EXT_V8HI nothing {extract}
>>  
>> -  const vsc __builtin_vec_init_v16qi (signed char, signed char, signed char, \
>> -            signed char, signed char, signed char, signed char, signed char, \
>> -            signed char, signed char, signed char, signed char, signed char, \
>> -            signed char, signed char, signed char);
>> -    VEC_INIT_V16QI nothing {init}
>> -
>> -  const vf __builtin_vec_init_v4sf (float, float, float, float);
>> -    VEC_INIT_V4SF nothing {init}
>> -
>> -  const vsi __builtin_vec_init_v4si (signed int, signed int, signed int, \
>> -                                     signed int);
>> -    VEC_INIT_V4SI nothing {init}
>> -
>> -  const vss __builtin_vec_init_v8hi (signed short, signed short, signed short,\
>> -             signed short, signed short, signed short, signed short, \
>> -             signed short);
>> -    VEC_INIT_V8HI nothing {init}
>> -
>> -  const vsc __builtin_vec_set_v16qi (vsc, signed char, const int<4>);
>> -    VEC_SET_V16QI nothing {set}
>> -
>> -  const vf __builtin_vec_set_v4sf (vf, float, const int<2>);
>> -    VEC_SET_V4SF nothing {set}
>> -
>> -  const vsi __builtin_vec_set_v4si (vsi, signed int, const int<2>);
>> -    VEC_SET_V4SI nothing {set}
>> -
>> -  const vss __builtin_vec_set_v8hi (vss, signed short, const int<3>);
>> -    VEC_SET_V8HI nothing {set}
>> -
>> -
>>  ; Cell builtins.
>>  [cell]
>>    pure vsc __builtin_altivec_lvlx (signed long, const void *);
>> @@ -1295,15 +1264,8 @@
>>    const signed long long __builtin_vec_ext_v2di (vsll, signed int);
>>      VEC_EXT_V2DI nothing {extract}
>>  
>> -  const vsq __builtin_vec_init_v1ti (signed __int128);
>> -    VEC_INIT_V1TI nothing {init}
>> -
>> -  const vd __builtin_vec_init_v2df (double, double);
>> -    VEC_INIT_V2DF nothing {init}
>> -
>> -  const vsll __builtin_vec_init_v2di (signed long long, signed long long);
>> -    VEC_INIT_V2DI nothing {init}
>> -
>> +;; VEC_SET_V1TI, VEC_SET_V2DF and VEC_SET_V2DI are used in
>> +;; resolve_vec_insert(), rs6000-c.cc
> 
> It would be good to place one TODO here, something like:

Added comment.

> 
> ;; TODO: Remove VEC_SET_V1TI, VEC_SET_V2DF and VEC_SET_V2DI once the uses
> ;; in resolve_vec_insert are replaced by the equivalent gimple statements.
> 
>>    const vsq __builtin_vec_set_v1ti (vsq, signed __int128, const int<0,0>);
>>      VEC_SET_V1TI nothing {set}
>>  
> 
> BR,
> Kewen
> 

      reply	other threads:[~2024-06-13 16:36 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-29 15:48 [PATCH 0/13 ver 3] rs6000, built-in cleanup patch series Carl Love
2024-05-29 15:52 ` [PATCH 1/13 ver 3] s6000, Remove __builtin_vsx_cmple* builtins Carl Love
2024-06-04  6:00   ` [PATCH 1/13 ver 3] rs6000, " Kewen.Lin
2024-06-05 22:25     ` Carl Love
2024-06-06  2:40       ` Kewen.Lin
2024-05-29 15:55 ` [PATCH 2/13 ver 3] rs6000, Remove __builtin_vsx_xvcvspsxws built-in Carl Love
2024-05-29 15:56 ` [PATCH 3/13 ver 3] rs6000, fix error in unsigned vector float to unsigned int built-in definition Carl Love
2024-06-04  5:58   ` Kewen.Lin
2024-05-29 15:58 ` [PATCH 4/13 ver 3] rs6000, extend the current vec_{un,}signed{e,o} built-ins Carl Love
2024-06-04  7:19   ` Kewen.Lin
2024-06-13 15:35     ` Carl Love
2024-05-29 16:00 ` [PATCH 5/13 ver 3] rs6000, Remove redundant float/double type conversions Carl Love
2024-06-04  6:20   ` Kewen.Lin
2024-05-29 16:01 ` [PATCH 6/13 ver 3] rs6000, remove duplicated built-ins of vecmergl and, vec_mergeh Carl Love
2024-05-29 16:03 ` [PATCH 7/13 ver 3] rs6000, add overloaded vec_sel with int128 arguments Carl Love
2024-06-04  5:58   ` Kewen.Lin
2024-06-13 15:35     ` Carl Love
2024-05-29 16:05 ` [PATCH 8/13 ver 3] rs6000, remove the vec_xxsel built-ins, they are, duplicates Carl Love
2024-06-04  5:58   ` Kewen.Lin
2024-05-29 16:06 ` [PATCH 9/13 ver 3] rs6000, remove __builtin_vsx_vperm_* built-ins Carl Love
2024-06-04  5:58   ` Kewen.Lin
2024-05-29 16:08 ` [PATCH 10/13 ver 3] rs6000, remove __builtin_vsx_xvnegdp and, __builtin_vsx_xvnegsp built-ins Carl Love
2024-05-29 16:10 ` [PATCH 11/13 ver 3] rs6000, extend vec_xxpermdi built-in for __int128 args Carl Love
2024-06-04  5:58   ` Kewen.Lin
2024-06-13 15:35     ` Carl Love
2024-05-29 16:11 ` [PATCH 12/13 ver 3] rs6000, remove __builtin_vsx_xvcmpeqsp_p built-in Carl Love
2024-06-04  5:59   ` Kewen.Lin
2024-05-29 16:16 ` [PATCH 13/13 ver 3] rs6000, remove vector set and vector init built-ins Carl Love
2024-06-04  5:59   ` Kewen.Lin
2024-06-13 15:35     ` Carl Love [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9c551899-7259-4dea-a8d0-5b461f285488@linux.ibm.com \
    --to=cel@linux.ibm.com \
    --cc=bergner@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=linkw@linux.ibm.com \
    --cc=segher@kernel.crashing.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).