aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/mv24.C
blob: 58292a833928b5e3364e33a4257dffb82e8bf8c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Test case to check if Multiversioning works for AES

// { dg-do run { target i?86-*-* x86_64-*-* } }
// { dg-require-ifunc "" }
// { dg-options "-O2" }

#include <assert.h>

// Check if AES feature selection works
int foo () __attribute__((target("default")));
int foo () __attribute__((target("aes")));

int main ()
{
  int val = foo ();

  if (__builtin_cpu_supports ("aes"))
    assert (val == 1);
  else
    assert (val == 0);

  return 0;
}

int __attribute__ ((target("default")))
foo ()
{
  return 0;
}

int __attribute__ ((target("aes")))
foo ()
{
  return 1;
}