[PATCH] Avoid false vector mask conversion
Ilya Enkovich
enkovich.gnu@gmail.com
Fri Dec 4 15:01:00 GMT 2015
On 02 Dec 16:27, Richard Biener wrote:
> On Wed, Dec 2, 2015 at 4:24 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
> >
> > The problem is that conversion is supposed to be handled by
> > vectorizable_conversion,
> > but it fails to because it is not actually a conversion. I suppose it
> > may be handled
> > in vectorizable_assignment but I chose this pattern because it's meant
> > to handle mask
> > conversion issues.
>
> I think it's always better to avoid patterns if you can.
>
> Richard.
>
Here is a variant with vectorizable_assignment change. Bootstrapped and regtested on x86_64-unknown-linux-gnu. Does it look better?
Thanks,
Ilya
--
gcc/
2015-12-04 Ilya Enkovich <enkovich.gnu@gmail.com>
* tree-vect-stmts.c (vectorizable_assignment): Support
useless boolean conversion.
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 3b078da..2cdbb04 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -4229,7 +4229,12 @@ vectorizable_assignment (gimple *stmt, gimple_stmt_iterator *gsi,
/* But a conversion that does not change the bit-pattern is ok. */
&& !((TYPE_PRECISION (TREE_TYPE (scalar_dest))
> TYPE_PRECISION (TREE_TYPE (op)))
- && TYPE_UNSIGNED (TREE_TYPE (op))))
+ && TYPE_UNSIGNED (TREE_TYPE (op)))
+ /* Conversion between boolean types of different sizes is
+ a simple assignment in case their vectypes are same
+ boolean vectors. */
+ && (!VECTOR_BOOLEAN_TYPE_P (vectype)
+ || !VECTOR_BOOLEAN_TYPE_P (vectype_in)))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
More information about the Gcc-patches
mailing list