https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89929
Bug ID: 89929 Summary: __attribute__((target("avx512bw"))) doesn't work on non avx512bw systems Product: gcc Version: 8.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nheart at gmail dot com Target Milestone: --- Created attachment 46075 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46075&action=edit testcase for attribute avx512bw Hey, I was trying to use function multi-versioning and it turns out that if I specify the attribute to __attribute__((target("avx512bw"))), I get a compilation error on non-avx512bw systems that reads: g++ test.cpp :( test.cpp: In function ‘_Z3fooi.resolver’: test.cpp:1:41: error: No dispatcher found for avx512bw __attribute__((target("avx512bw"))) int foo(int i) { This works fine if I specify -mavx512f in a sense that it compiles, but dispatches to the wrong function at runtime (as it probably ignores the avx2 target in the compilation) I change avx512bw to avx512f the program compiles correctly and at runtime dispatches to the correct function version for my processor (avx2). The problem doesn't occur in clang v8, not that it is relevant. In addition, it seems that gcc recognizes this as valid syntax: __attribute__((target("avx512bw", "avx512f"))) But actually ignores everything after the comma in target's arguments. Not sure if I should open another bug for that. Please find a small testcase attached.