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 
16 int __attribute__ ((target ("sse")))
foo()17 foo ()
18 {
19   return 1;
20 }
21 int __attribute__ ((target ("popcnt")))
foo()22 foo ()
23 {
24   return 0;
25 }
26 
27 int __attribute__ ((target ("popcnt")))
bar()28 bar ()
29 {
30   return foo ();
31 }
32 
main()33 int main ()
34 {
35   return bar ();
36 }
37