From: Richard Biener Date: Thu, 26 Jun 2025 09:45:05 +0000 (+0200) Subject: Fixup partial_vectors_supported_p use X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a0af6fd825d53333d0a1e3a5cdb3a2fe4c751c2e;p=thirdparty%2Fgcc.git Fixup partial_vectors_supported_p use The following fixes the computation of supports_partial_vectors which is used to prune the set of modes to iterate over for epilog vectorization. The used partial_vectors_supported_p predicate only looks for while_ult while also support predication when mask modes are integer modes as for AVX512. I've noticed this isn't very effective on x86_64 anyway since if the main loop mode is autodetected we skip re-analyzing mode_i == 0, but then mode_i == 1 is usually the very same large mode. A patch for this will follow, but this will regress without the fix below. * tree-vect-loop.cc (vect_analyze_loop): Consider AVX512 style masking when computing supports_partial_vectors. --- diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 5b6769af31c..18404f01c1e 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -3701,8 +3701,15 @@ vect_analyze_loop (class loop *loop, gimple *loop_vectorized_call, vector_modes[0] = autodetected_vector_mode; mode_i = 0; - bool supports_partial_vectors = - partial_vectors_supported_p () && param_vect_partial_vector_usage != 0; + bool supports_partial_vectors = param_vect_partial_vector_usage != 0; + machine_mode mask_mode; + if (supports_partial_vectors + && !partial_vectors_supported_p () + && !(VECTOR_MODE_P (first_loop_vinfo->vector_mode) + && targetm.vectorize.get_mask_mode + (first_loop_vinfo->vector_mode).exists (&mask_mode) + && SCALAR_INT_MODE_P (mask_mode))) + supports_partial_vectors = false; poly_uint64 first_vinfo_vf = LOOP_VINFO_VECT_FACTOR (first_loop_vinfo); loop_vec_info orig_loop_vinfo = first_loop_vinfo;