tree-optimization/119534 - reject bogus emulated vectorized gather

The following makes sure to reject the attempts to emulate a vector
gather when the discovered index vector type is a vector mask.

	PR tree-optimization/119534
	* tree-vect-stmts.cc (get_load_store_type): Reject
	VECTOR_BOOLEAN_TYPE_P offset vector type for emulated gathers.

	* gcc.dg/vect/pr119534.c: New testcase.
This commit is contained in:
Richard Biener 2025-04-01 14:13:03 +02:00 committed by Richard Biener
parent e9803f10c9
commit d0cc14c62a
2 changed files with 12 additions and 0 deletions

View file

@ -0,0 +1,11 @@
/* { dg-do compile } */
/* { dg-additional-options "-mavx512bw" { target { x86_64-*-* i?86-*-* } } } */
void f(int w, int *out, double *d)
{
for (int j = 0; j < w; j++)
{
const int i = (j >= w / 2);
out[j] += d[i];
}
}

View file

@ -2522,6 +2522,7 @@ get_load_store_type (vec_info *vinfo, stmt_vec_info stmt_info,
{
if (!TYPE_VECTOR_SUBPARTS (vectype).is_constant ()
|| !TYPE_VECTOR_SUBPARTS (gs_info->offset_vectype).is_constant ()
|| VECTOR_BOOLEAN_TYPE_P (gs_info->offset_vectype)
|| !constant_multiple_p (TYPE_VECTOR_SUBPARTS
(gs_info->offset_vectype),
TYPE_VECTOR_SUBPARTS (vectype)))