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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [i386/] [asm-4.c] - Blame information for rev 328

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

Line No. Rev Author Line
1 318 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 } */
5
/* The asm in this test uses an absolute address.  */
6
/* { dg-require-effective-target nonpic } */
7
/* { dg-options "-O2" } */
8
 
9
extern void abort (void);
10
 
11
static int foo (int, int, int, int) __asm ("foo");
12
static __attribute__((noinline, used)) int
13
foo (int i, int j, int k, int l)
14
{
15
  return i + j + k + l;
16
}
17
 
18
void
19
bar (void)
20
{
21
  if (foo (1, 2, 3, 4) != 10)
22
    abort ();
23
}
24
 
25
int (*fn) (int, int, int, int);
26
 
27
void
28
baz (void)
29
{
30
  /* Darwin loads 64-bit regions above the 4GB boundary so
31
     we need to use this instead.  */
32
#if defined (__LP64__) && defined (__MACH__)
33
  __asm ("leaq foo(%%rip), %0" : "=r" (fn));
34
#else
35
  __asm ("movl $foo, %k0" : "=r" (fn));
36
#endif
37
  if (fn (2, 3, 4, 5) != 14)
38
    abort ();
39
}
40
 
41
int
42
main (void)
43
{
44
  bar ();
45
  baz ();
46
  return 0;
47
}

powered by: WebSVN 2.1.0

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