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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [arm/] [frame-pointer-1.c] - Blame information for rev 801

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

Line No. Rev Author Line
1 691 jeremybenn
/* Check local register variables using a register conventionally
2
   used as the frame pointer aren't clobbered under high register pressure.  */
3
/* { dg-do run } */
4
/* { dg-options "-Os -mthumb -fomit-frame-pointer" } */
5
 
6
#include <stdlib.h>
7
 
8
int global=5;
9
 
10
void __attribute__((noinline)) foo(int p1, int p2, int p3, int p4)
11
{
12
  if (global != 5 || p1 != 1 || p2 != 2 || p3 != 3 || p4 != 4)
13
    abort();
14
}
15
 
16
int __attribute__((noinline)) test(int a, int b, int c, int d)
17
{
18
  register unsigned long r __asm__("r7") = 0xdeadbeef;
19
  int e;
20
 
21
  /* ABCD are live after the call which should be enough
22
     to cause r7 to be used if it weren't for the register variable.  */
23
  foo(a,b,c,d);
24
 
25
  e = 0;
26
  __asm__ __volatile__ ("mov %0, %2"
27
                        : "=r" (e)
28
                        : "0" (e), "r" (r));
29
 
30
  global = a+b+c+d;
31
 
32
  return e;
33
}
34
 
35
int main()
36
{
37
  if (test(1, 2, 3, 4) != 0xdeadbeef)
38
    abort();
39
  if (global != 10)
40
    abort();
41
  return 0;
42
}

powered by: WebSVN 2.1.0

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