https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99102
--- Comment #4 from Joel Hutton <joelh at gcc dot gnu.org> ---
It seems it is vectorizing a 'MASK_STORE' into a 'SCATTER_STORE' when it should
be using a 'MASK_SCATTER_STORE'. Currently it's choosing between
IFN_SCATTER_STORE and IFN_MASK_SCATTER_STORE based on the
'using_partial_vectors' field.
7729 vec_loop_masks *loop_masks
7730 = (loop_vinfo && LOOP_VINFO_FULLY_MASKED_P (loop_vinfo)
7731 ? &LOOP_VINFO_MASKS (loop_vinfo)
7732 : NULL);
7733 vec_loop_lens *loop_lens
7734 = (loop_vinfo && LOOP_VINFO_FULLY_WITH_LENGTH_P (loop_vinfo)
7735 ? &LOOP_VINFO_LENS (loop_vinfo)
7736 : NULL);
806 #define LOOP_VINFO_FULLY_MASKED_P(L)>--->-------\$
807 (LOOP_VINFO_USING_PARTIAL_VECTORS_P (L)>------\$
808 && !LOOP_VINFO_MASKS (L).is_empty ())$
809 $
8005 if (memory_access_type == VMAT_GATHER_SCATTER)
8006 {
8007 tree scale = size_int (gs_info.scale);
8008 gcall *call;
8009 if (loop_masks)
8010 call = gimple_build_call_internal
8011 (IFN_MASK_SCATTER_STORE, 5, dataref_ptr,
vec_offset,
8012 scale, vec_oprnd, final_mask);
8013 else
8014 call = gimple_build_call_internal
8015 (IFN_SCATTER_STORE, 4, dataref_ptr, vec_offset,
8016 scale, vec_oprnd);
8017 gimple_call_set_nothrow (call, true);
8018 vect_finish_stmt_generation (vinfo, stmt_info, call,
gsi);
8019 new_stmt = call;
8020 break;
8021 }
8022
8023 if (i > 0)
8024 /* Bump the vector pointer. */
8025 dataref_ptr = bump_vector_ptr (vinfo, dataref_ptr,
ptr_incr,
8026 gsi, stmt_info, bump);
8027
8028 if (slp)
8029 vec_oprnd = vec_oprnds[i];