This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, rs6000] Early gimple folding of vec_mergeh and vec_mergel for float
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Will Schmidt <will_schmidt at vnet dot ibm dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, Bill Schmidt <wschmidt at linux dot vnet dot ibm dot com>, David Edelsohn <dje dot gcc at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 7 Aug 2018 17:59:36 -0500
- Subject: Re: [PATCH, rs6000] Early gimple folding of vec_mergeh and vec_mergel for float
- References: <1533669898.4452.11.camel@brimstone.rchland.ibm.com>
Hi!
On Tue, Aug 07, 2018 at 02:24:58PM -0500, Will Schmidt wrote:
> This adds support for gimple folding of vec_mergeh and vec_mergel
> for float and double types. Support for the integral types is already
> in-tree.
> + /* The permute_type will match the lhs for integral types. For double and
> + float types, the permute type needs to map to the V2 or V4 type that
> + matches size. */
> + 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))
> + permute_type = V2DI_type_node;
> + else if (TREE_TYPE (lhs_type) == TREE_TYPE (V4SF_type_node))
> + permute_type = V4SI_type_node;
> + else
> + gcc_unreachable ();
Please write this as
if (INTEGRAL_TYPE_P (TREE_TYPE (lhs_type)))
permute_type = lhs_type;
else if (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))
permute_type = V4SI_type_node;
else
gcc_unreachable ();
or, if you want to emphasize integer vs. float:
if (INTEGRAL_TYPE_P (TREE_TYPE (lhs_type)))
permute_type = lhs_type;
else
{
if (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))
permute_type = V4SI_type_node;
else
gcc_unreachable ();
}
Okay for trunk with that changed. Thanks!
Segher