]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/103527 - always use thruth type forgather mask
authorRichard Biener <rguenther@suse.de>
Thu, 2 Dec 2021 11:21:19 +0000 (12:21 +0100)
committerRichard Biener <rguenther@suse.de>
Thu, 2 Dec 2021 12:32:11 +0000 (13:32 +0100)
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.

2021-12-02  Richard Biener  <rguenther@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

index 9726450ab2dcbebd741727820ec2d90dac257152..e63bc2afdaafd95e6b3715c317deb0f1ed465f14 100644 (file)
@@ -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);