1/* Test case to check if a call to a multiversioned function
2   is replaced with a direct call to the particular version when
3   the most specialized version's target attributes match the
4   caller.
5
6   In this program, foo is multiversioned but there is no default
7   function.  This is an error if the call has to go through a
8   dispatcher.  However, the call to foo in bar can be replaced
9   with a direct call to the popcnt version of foo.  Hence, this
10   test should pass.  */
11
12/* { dg-do run { target i?86-*-* x86_64-*-* } } */
13/* { dg-options "-O2" } */
14
15
16int __attribute__ ((target ("sse")))
17foo ()
18{
19  return 1;
20}
21int __attribute__ ((target ("popcnt")))
22foo ()
23{
24  return 0;
25}
26
27int __attribute__ ((target ("popcnt")))
28bar ()
29{
30  return foo ();
31}
32
33int main ()
34{
35  return bar ();
36}
37