1 /* Test case to check if Multiversioning chooses the correct
2 dispatching order when versions are for various ISAs. */
3 /* { dg-do run { target i?86-*-* x86_64-*-* } } */
4 /* { dg-require-ifunc "" } */
5 /* { dg-options "-O2" } */
10 int foo () __attribute__ ((target ("default")));
11 /* The dispatch checks should be in the exact reverse order of the
12 declarations below. */
13 int foo () __attribute__ ((target ("mmx")));
14 int foo () __attribute__ ((target ("sse")));
15 int foo () __attribute__ ((target ("sse2")));
16 int foo () __attribute__ ((target ("sse3")));
17 int foo () __attribute__ ((target ("ssse3")));
18 int foo () __attribute__ ((target ("sse4.1")));
19 int foo () __attribute__ ((target ("sse4.2")));
20 int foo () __attribute__ ((target ("popcnt")));
21 int foo () __attribute__ ((target ("avx")));
22 int foo () __attribute__ ((target ("avx2")));
23 int foo () __attribute__ ((target ("avx512f")));
29 if (__builtin_cpu_supports ("avx512f"))
31 else if (__builtin_cpu_supports ("avx2"))
33 else if (__builtin_cpu_supports ("avx"))
35 else if (__builtin_cpu_supports ("popcnt"))
37 else if (__builtin_cpu_supports ("sse4.2"))
39 else if (__builtin_cpu_supports ("sse4.1"))
41 else if (__builtin_cpu_supports ("ssse3"))
43 else if (__builtin_cpu_supports ("sse3"))
45 else if (__builtin_cpu_supports ("sse2"))
47 else if (__builtin_cpu_supports ("sse"))
49 else if (__builtin_cpu_supports ("mmx"))
57 int __attribute__ ((target("default")))
63 int __attribute__ ((target("mmx")))
69 int __attribute__ ((target("sse")))
75 int __attribute__ ((target("sse2")))
81 int __attribute__ ((target("sse3")))
87 int __attribute__ ((target("ssse3")))
93 int __attribute__ ((target("sse4.1")))
99 int __attribute__ ((target("sse4.2")))
105 int __attribute__ ((target("popcnt")))
111 int __attribute__ ((target("avx")))
117 int __attribute__ ((target("avx2")))
123 int __attribute__ ((target("avx512f")))