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.
--- /dev/null
+/* { 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];
+ }
+}
{
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)))