tree-optimization/109502 - vector conversion between mask and non-mask

The following fixes a check that should have rejected vectorizing
a conversion between a mask and non-mask type.  Those should be
done via pattern statements.

	PR tree-optimization/109502
	* tree-vect-stmts.cc (vectorizable_assignment): Fix
	check for conversion between mask and non-mask types.

	* gcc.dg/vect/pr109502.c: New testcase.
This commit is contained in:
Richard Biener
2023-04-14 09:55:27 +02:00
parent 040e64b09d
commit bf24f2db28
2 changed files with 22 additions and 2 deletions
+21
View File
@@ -0,0 +1,21 @@
/* { dg-do run } */
/* { dg-additional-options "-O" } */
unsigned g;
unsigned
foo (void)
{
unsigned a = !g;
a += !(a % 6);
return a;
}
int
main ()
{
unsigned x = foo ();
if (x != 1)
__builtin_abort ();
return 0;
}
+1 -2
View File
@@ -5595,8 +5595,7 @@ vectorizable_assignment (vec_info *vinfo,
GET_MODE_SIZE (TYPE_MODE (vectype_in)))))
return false;
if (VECTOR_BOOLEAN_TYPE_P (vectype)
&& !VECTOR_BOOLEAN_TYPE_P (vectype_in))
if (VECTOR_BOOLEAN_TYPE_P (vectype) != VECTOR_BOOLEAN_TYPE_P (vectype_in))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,