Debian Codegraph @

gcc/testsuite/g++.target/i386/mv33.C

raw
1 // Test that dispatching can choose the right multiversion
2 // for HYGON CPUs with the same internal GCC processor id
3
4 // { dg-do run }
5 // { dg-require-ifunc "" }
6 // { dg-options "-O2" }
7
8 #include <assert.h>
9
10 int __attribute__ ((target("default")))
11 foo ()
12 {
13 return 0;
14 }
15
16 int __attribute__ ((target("arch=c86-4g-m4"))) foo () {
17 return 1;
18 }
19
20 int __attribute__ ((target("arch=c86-4g-m6"))) foo () {
21 return 2;
22 }
23
24 int __attribute__ ((target("arch=c86-4g-m7"))) foo () {
25 return 3;
26 }
27
28 int main ()
29 {
30 int val = foo ();
31
32 if (__builtin_cpu_is ("c86-4g-m4"))
33 assert (val == 1);
34 else if (__builtin_cpu_is ("c86-4g-m6"))
35 assert (val == 2);
36 else if (__builtin_cpu_is ("c86-4g-m7"))
37 assert (val == 3);
38 else
39 assert (val == 0);
40
41 return 0;
42 }