Debian Codegraph @

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

raw
1 // Test that dispatching can choose the right multiversion
2 // for ZHAOXIN CPU 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=lujiazui"))) foo () {
17 return 1;
18 }
19
20 int __attribute__ ((target("arch=yongfeng"))) foo () {
21 return 2;
22 }
23
24 int __attribute__ ((target("arch=shijidadao"))) foo () {
25 return 3;
26 }
27
28 int main ()
29 {
30 int val = foo ();
31
32 if (__builtin_cpu_is ("lujiazui"))
33 assert (val == 1);
34 else if (__builtin_cpu_is ("yongfeng"))
35 assert (val == 2);
36 else if (__builtin_cpu_is ("shijidadao"))
37 assert (val == 3);
38 else
39 assert (val == 0);
40
41 return 0;
42 }