https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101939
Bug ID: 101939 Summary: Register spilling when zero initialization of ymm array is defered past the declaration point. Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: ts.tomeksopel at gmail dot com Target Milestone: --- using __m256i r[8] = {_mm256_setzero_si256()}; as opposed to __m256i r[8]; for (int i = 0; i < 8; ++i) r[i] = _mm256_setzero_si256(); before a hot loop results in MUCH better codegen. See godbolt below. https://godbolt.org/z/sbscKzso3