OSDN Git Service

Index: gcc/ChangeLog
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / i386-asm-4.c
1 /* Test if functions marked __attribute__((used)), but with address never
2    taken in C code, don't use alternate calling convention for local
3    functions on IA-32.  */
4 /* { dg-do run { target i?86-*-* x86_64-*-* } } */
5 /* { dg-options "-O2" } */
6
7 extern void abort (void);
8
9 static int foo (int, int, int, int) __asm ("foo");
10 static __attribute__((noinline, used)) int
11 foo (int i, int j, int k, int l)
12 {
13   return i + j + k + l;
14 }
15
16 void
17 bar (void)
18 {
19   if (foo (1, 2, 3, 4) != 10)
20     abort ();
21 }
22
23 int (*fn) (int, int, int, int);
24
25 void
26 baz (void)
27 {
28   __asm ("movl $foo, %k0" : "=r" (fn));
29   if (fn (2, 3, 4, 5) != 14)
30     abort ();
31 }
32
33 int
34 main (void)
35 {
36   bar ();
37   baz ();
38   return 0;
39 }