@@ -25353,6 +25353,18 @@ ix86_vector_costs::finish_cost (const vector_costs *scalar_costs)
&& TARGET_AVX256_AVOID_VEC_PERM)
m_costs[i] = INT_MAX;
+ /* When X86_TUNE_AVX512_TWO_EPILOGUES is enabled arrange for both
+ a AVX2 and a SSE epilogue for AVX512 vectorized loops. */
+ if (loop_vinfo
+ && ix86_tune_features[X86_TUNE_AVX512_TWO_EPILOGUES])
+ {
+ if (GET_MODE_SIZE (loop_vinfo->vector_mode) == 64)
+ m_suggested_epilogue_mode = V32QImode;
+ else if (LOOP_VINFO_EPILOGUE_P (loop_vinfo)
+ && GET_MODE_SIZE (loop_vinfo->vector_mode) == 32)
+ m_suggested_epilogue_mode = V16QImode;
+ }
+
vector_costs::finish_cost (scalar_costs);
}
@@ -597,6 +597,11 @@ DEF_TUNE (X86_TUNE_AVX512_MOVE_BY_PIECES, "avx512_move_by_pieces",
DEF_TUNE (X86_TUNE_AVX512_STORE_BY_PIECES, "avx512_store_by_pieces",
m_SAPPHIRERAPIDS | m_ZNVER4 | m_ZNVER5)
+/* X86_TUNE_AVX512_TWO_EPILOGUES: Use two vector epilogues for 512-bit
+ vectorized loops. */
+DEF_TUNE (X86_TUNE_AVX512_TWO_EPILOGUES, "avx512_two_epilogues",
+ m_ZNVER5)
+
/*****************************************************************************/
/*****************************************************************************/
/* Historical relics: tuning flags that helps a specific old CPU designs */