aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/mv25.C
blob: fd40eca59a5b7ea4a4f7b14ed662baffc0fe386b (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 PCLMUL

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

#include <assert.h>

// Check if PCLMUL feature selection works
int foo () __attribute__((target("default")));
int foo () __attribute__((target("pclmul")));

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

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

  return 0;
}

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

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