131
|
1 // Test case to check if Multiversioning works for AES
|
|
2
|
|
3 // { dg-do run }
|
|
4 // { dg-require-ifunc "" }
|
|
5 // { dg-options "-O2" }
|
|
6
|
|
7 #include <assert.h>
|
|
8
|
|
9 // Check if AES feature selection works
|
|
10 int foo () __attribute__((target("default")));
|
|
11 int foo () __attribute__((target("aes")));
|
|
12
|
|
13 int main ()
|
|
14 {
|
|
15 int val = foo ();
|
|
16
|
|
17 if (__builtin_cpu_supports ("aes"))
|
|
18 assert (val == 1);
|
|
19 else
|
|
20 assert (val == 0);
|
|
21
|
|
22 return 0;
|
|
23 }
|
|
24
|
|
25 int __attribute__ ((target("default")))
|
|
26 foo ()
|
|
27 {
|
|
28 return 0;
|
|
29 }
|
|
30
|
|
31 int __attribute__ ((target("aes")))
|
|
32 foo ()
|
|
33 {
|
|
34 return 1;
|
|
35 }
|