diff mbox series

[rs6000] Improve TREE_TYPE comparisons in fold_mergehl_helper()

Message ID 1534801235.26070.16.camel@brimstone.rchland.ibm.com
State New
Headers show
Series [rs6000] Improve TREE_TYPE comparisons in fold_mergehl_helper() | expand

Commit Message

will schmidt Aug. 20, 2018, 9:40 p.m. UTC
Hi,
This is a follow-up to an earlier patch that enabled gimple folding of
vec_mergeh and vec_mergel for the float and double data types.

Per feedback from Richard, use the types_compatible_p helper to ensure
we also catch any qualified types matching the V2DF_ or V4SF_ types.
    
Regtests ran clean.   OK for trunk?
    
Thanks,
-Will
    
[gcc]
    
2018-08-20  Will Schmidt  <will_schmidt@vnet.ibm.com>

	* config/rs6000/rs6000.c (fold_mergehl_helper): Add types_compatible_p
	wrappers around TREE_TYPE comparisons.

Comments

Segher Boessenkool Aug. 20, 2018, 10:07 p.m. UTC | #1
Hi Will,

On Mon, Aug 20, 2018 at 04:40:35PM -0500, Will Schmidt wrote:
> This is a follow-up to an earlier patch that enabled gimple folding of
> vec_mergeh and vec_mergel for the float and double data types.
> 
> Per feedback from Richard, use the types_compatible_p helper to ensure
> we also catch any qualified types matching the V2DF_ or V4SF_ types.

That looks fine; if no one hollers, please commit.  Thanks!

I note we use lang_hooks.types_compatible_p a lot, which is a totally
different thing?  How confusing :-/


Segher


> 2018-08-20  Will Schmidt  <will_schmidt@vnet.ibm.com>
> 
> 	* config/rs6000/rs6000.c (fold_mergehl_helper): Add types_compatible_p
> 	wrappers around TREE_TYPE comparisons.
> 
> diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
> index 97b922f..5f77afd 100644
> --- a/gcc/config/rs6000/rs6000.c
> +++ b/gcc/config/rs6000/rs6000.c
> @@ -15135,13 +15135,15 @@ fold_mergehl_helper (gimple_stmt_iterator *gsi, gimple *stmt, int use_high)
>    tree permute_type;
>    if (INTEGRAL_TYPE_P (TREE_TYPE (lhs_type)))
>      permute_type = lhs_type;
>    else
>      {
> -      if (TREE_TYPE (lhs_type) == TREE_TYPE (V2DF_type_node))
> +      if (types_compatible_p (TREE_TYPE (lhs_type),
> +			      TREE_TYPE (V2DF_type_node)))
>  	permute_type = V2DI_type_node;
> -      else if (TREE_TYPE (lhs_type) == TREE_TYPE (V4SF_type_node))
> +      else if (types_compatible_p (TREE_TYPE (lhs_type),
> +				   TREE_TYPE (V4SF_type_node)))
>  	permute_type = V4SI_type_node;
>        else
>  	gcc_unreachable ();
>      }
>    tree_vector_builder elts (permute_type, VECTOR_CST_NELTS (arg0), 1);
>
Richard Biener Aug. 21, 2018, 8:10 a.m. UTC | #2
On Tue, Aug 21, 2018 at 12:07 AM Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> Hi Will,
>
> On Mon, Aug 20, 2018 at 04:40:35PM -0500, Will Schmidt wrote:
> > This is a follow-up to an earlier patch that enabled gimple folding of
> > vec_mergeh and vec_mergel for the float and double data types.
> >
> > Per feedback from Richard, use the types_compatible_p helper to ensure
> > we also catch any qualified types matching the V2DF_ or V4SF_ types.
>
> That looks fine; if no one hollers, please commit.  Thanks!
>
> I note we use lang_hooks.types_compatible_p a lot, which is a totally
> different thing?  How confusing :-/

Yeah, that's supposed to be used in target hooks used by frontends.

Richard.

>
> Segher
>
>
> > 2018-08-20  Will Schmidt  <will_schmidt@vnet.ibm.com>
> >
> >       * config/rs6000/rs6000.c (fold_mergehl_helper): Add types_compatible_p
> >       wrappers around TREE_TYPE comparisons.
> >
> > diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
> > index 97b922f..5f77afd 100644
> > --- a/gcc/config/rs6000/rs6000.c
> > +++ b/gcc/config/rs6000/rs6000.c
> > @@ -15135,13 +15135,15 @@ fold_mergehl_helper (gimple_stmt_iterator *gsi, gimple *stmt, int use_high)
> >    tree permute_type;
> >    if (INTEGRAL_TYPE_P (TREE_TYPE (lhs_type)))
> >      permute_type = lhs_type;
> >    else
> >      {
> > -      if (TREE_TYPE (lhs_type) == TREE_TYPE (V2DF_type_node))
> > +      if (types_compatible_p (TREE_TYPE (lhs_type),
> > +                           TREE_TYPE (V2DF_type_node)))
> >       permute_type = V2DI_type_node;
> > -      else if (TREE_TYPE (lhs_type) == TREE_TYPE (V4SF_type_node))
> > +      else if (types_compatible_p (TREE_TYPE (lhs_type),
> > +                                TREE_TYPE (V4SF_type_node)))
> >       permute_type = V4SI_type_node;
> >        else
> >       gcc_unreachable ();
> >      }
> >    tree_vector_builder elts (permute_type, VECTOR_CST_NELTS (arg0), 1);
> >
diff mbox series

Patch

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 97b922f..5f77afd 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -15135,13 +15135,15 @@  fold_mergehl_helper (gimple_stmt_iterator *gsi, gimple *stmt, int use_high)
   tree permute_type;
   if (INTEGRAL_TYPE_P (TREE_TYPE (lhs_type)))
     permute_type = lhs_type;
   else
     {
-      if (TREE_TYPE (lhs_type) == TREE_TYPE (V2DF_type_node))
+      if (types_compatible_p (TREE_TYPE (lhs_type),
+			      TREE_TYPE (V2DF_type_node)))
 	permute_type = V2DI_type_node;
-      else if (TREE_TYPE (lhs_type) == TREE_TYPE (V4SF_type_node))
+      else if (types_compatible_p (TREE_TYPE (lhs_type),
+				   TREE_TYPE (V4SF_type_node)))
 	permute_type = V4SI_type_node;
       else
 	gcc_unreachable ();
     }
   tree_vector_builder elts (permute_type, VECTOR_CST_NELTS (arg0), 1);