aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/ext/mv3.C
blob: ec2aa1ffec234646d927b4b4b4fe9eb4f5f9ef4e (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
36
/* Test case to check if a call to a multiversioned function
   is replaced with a direct call to the particular version when
   the most specialized version's target attributes match the
   caller.  
  
   In this program, foo is multiversioned but there is no default
   function.  This is an error if the call has to go through a
   dispatcher.  However, the call to foo in bar can be replaced
   with a direct call to the popcnt version of foo.  Hence, this
   test should pass.  */

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


int __attribute__ ((target ("sse")))
foo ()
{
  return 1;
}
int __attribute__ ((target ("popcnt")))
foo ()
{
  return 0;
}

int __attribute__ ((target ("popcnt")))
bar ()
{
  return foo ();
}

int main ()
{
  return bar ();
}