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")));
28 if (__builtin_cpu_supports ("avx2"))
30 else if (__builtin_cpu_supports ("avx"))
32 else if (__builtin_cpu_supports ("popcnt"))
34 else if (__builtin_cpu_supports ("sse4.2"))
36 else if (__builtin_cpu_supports ("sse4.1"))
38 else if (__builtin_cpu_supports ("ssse3"))
40 else if (__builtin_cpu_supports ("sse3"))
42 else if (__builtin_cpu_supports ("sse2"))
44 else if (__builtin_cpu_supports ("sse"))
46 else if (__builtin_cpu_supports ("mmx"))
54 int __attribute__ ((target("default")))
60 int __attribute__ ((target("mmx")))
66 int __attribute__ ((target("sse")))
72 int __attribute__ ((target("sse2")))
78 int __attribute__ ((target("sse3")))
84 int __attribute__ ((target("ssse3")))
90 int __attribute__ ((target("sse4.1")))
96 int __attribute__ ((target("sse4.2")))
102 int __attribute__ ((target("popcnt")))
108 int __attribute__ ((target("avx")))
114 int __attribute__ ((target("avx2")))