The generic expand_vector_piecewise routine supports lowering of
a vector operation to vector operations of smaller size. When
computing the extract position from the larger vector it uses the
element size in bits of the original result vector to determine
the number of elements in the smaller vector. That is wrong when
lowering a compare as the vector element size of a bool vector
does not have to agree with that of the compare operand. The
following simplifies this, fixing the error.
PR middle-end/118062
* tree-vect-generic.cc (expand_vector_piecewise): Properly
compute delta.
tree part_width = TYPE_SIZE (inner_type);
tree index = bitsize_int (0);
int nunits = nunits_for_known_piecewise_op (type);
- int delta = tree_to_uhwi (part_width) / vector_element_bits (type);
+ int delta = (VECTOR_TYPE_P (inner_type)
+ ? nunits_for_known_piecewise_op (inner_type) : 1);
int i;
location_t loc = gimple_location (gsi_stmt (*gsi));