This makes sure to always use a truth type to build the gather mask argument even when the target builtin prototype in the end wants a float vector.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. 2021-12-02 Richard Biener <rguent...@suse.de> PR tree-optimization/103527 * tree-vect-stmts.c (vect_build_gather_load_calls): Always use a truth type for building the vector mask. --- gcc/tree-vect-stmts.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 9726450ab2d..e63bc2afdaa 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -2740,7 +2740,7 @@ vect_build_gather_load_calls (vec_info *vinfo, stmt_vec_info stmt_info, && (!mask || TREE_CODE (masktype) == INTEGER_TYPE || types_compatible_p (srctype, masktype))); - if (mask && TREE_CODE (masktype) == INTEGER_TYPE) + if (mask) masktype = truth_type_for (srctype); tree mask_halftype = masktype; @@ -2893,7 +2893,8 @@ vect_build_gather_load_calls (vec_info *vinfo, stmt_vec_info stmt_info, if (masktype != real_masktype) { tree utype, optype = TREE_TYPE (mask_op); - if (TYPE_MODE (real_masktype) == TYPE_MODE (optype)) + if (VECTOR_TYPE_P (real_masktype) + || TYPE_MODE (real_masktype) == TYPE_MODE (optype)) utype = real_masktype; else utype = lang_hooks.types.type_for_mode (TYPE_MODE (optype), 1); -- 2.31.1