This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, rs6000] Improve TREE_TYPE comparisons in fold_mergehl_helper()
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.
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);