https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116065
Bug ID: 116065 Summary: [13/14/15 Regression] Function attribute optimize() might make ISA target attribute broken Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: haochen.jiang at intel dot com Target Milestone: --- When we compiled the code following: #include <immintrin.h> __m256 a[10], b[10], c[10]; void __attribute__((target ("avx"), optimize(3))) bar (void) { a[0] = _mm256_and_ps (b[0], c[0]); } with -O0 -msse -mno-avx, it will report ABI warning and target option mismatch. -O1 will also fail, -O2 would be ok. It failed since GCC13.1. Original testcase: https://godbolt.org/z/YbPKen7P5 I tested with different combinations, -O0/-O1 will only work with optimize(0/1) and -O2/-O3 will only work with optimize(2/3). Otherwise, it will fail. Also, if we put optimize() before target attribute, it will always pass.