OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.target/] [i386/] [asm-4.c] - Blame information for rev 820

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* 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
  /* Darwin loads 64-bit regions above the 4GB boundary so
29
     we need to use this instead.  */
30
#if defined (__LP64__) && defined (__MACH__)
31
  __asm ("leaq foo(%%rip), %0" : "=r" (fn));
32
#else
33
  __asm ("movl $foo, %k0" : "=r" (fn));
34
#endif
35
  if (fn (2, 3, 4, 5) != 14)
36
    abort ();
37
}
38
 
39
int
40
main (void)
41
{
42
  bar ();
43
  baz ();
44
  return 0;
45
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.