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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [20020312-2.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* PR 5878.
2
 
3
   We ICEd in verify_local_live_at_start because we incorrectly forced
4
   the PIC register live between BAR and BAZ.  We did this because the
5
   definition of PIC_OFFSET_TABLE_REGNUM was incorrectly not INVALID_REGNUM
6
   when !flag_pic for most targets.  */
7
 
8
/* { dg-do run } */
9
/* { dg-options "-O -fno-pic" } */
10
 
11
extern void abort (void);
12
 
13
#if defined(__alpha__)
14
/* PIC register is $29, but is used even without -fpic.  */
15
#elif defined(__arc__)
16
# define PIC_REG  "26"
17
#elif defined(__arm__)
18
# define PIC_REG  "9"
19
#elif defined(AVR)
20
/* No pic register.  */
21
#elif defined(__cris__)
22
# define PIC_REG  "0"
23
#elif defined(__epiphany__)
24
#define PIC_REG "r28"
25
#elif defined(__fr30__)
26
/* No pic register.  */
27
#elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__)
28
/* No pic register.  */
29
#elif defined(_IBMR2)
30
/* No pic register.  */
31
#elif defined(__i386__)
32
# define PIC_REG  "ebx"
33
#elif defined(__ia64__)
34
/* PIC register is r1, but is used even without -fpic.  */
35
#elif defined(__lm32__)
36
/* No pic register.  */
37
#elif defined(__M32R__)
38
/* No pic register.  */
39
#elif defined(__m68k__)
40
# define PIC_REG  "a5"
41
#elif defined(__mc68hc1x__)
42
/* No pic register.  */
43
#elif defined(__mcore__)
44
/* No pic register.  */
45
#elif defined(__mips__)
46
/* PIC register is $28, but is used even without -fpic.  */
47
#elif defined(__MMIX__)
48
/* No pic register.  */
49
#elif defined(__mn10300__)
50
/* No pic register.  */
51
#elif defined(__moxie__)
52
/* No pic register.  */
53
#elif defined(__hppa__)
54
/* PIC register is %r27 or %r19, but is used even without -fpic.  */
55
#elif defined(__pdp11__)
56
/* No pic register.  */
57
#elif defined(__powerpc__) || defined(__PPC__) || defined(__POWERPC__) || defined (__ppc)
58
# ifdef __MACH__
59
#  define PIC_REG  "31"
60
# else
61
#  define PIC_REG  "30"
62
# endif
63
#elif defined(__RX__)
64
/* No pic register.  */
65
#elif defined(__s390__)
66
# define PIC_REG  "12"
67
#elif defined(__sparc__)
68
# define PIC_REG  "l7"
69
#elif defined(__tile__)
70
# define PIC_REG "r51"
71
#elif defined(__TMS320C6X__)
72
# define PIC_REG "B14"
73
#elif defined(__v850)
74
/* No pic register.  */
75
#elif defined(__vax__)
76
/* No pic register.  */
77
#elif defined(__xstormy16__)
78
/* No pic register.  */
79
#elif defined(__XTENSA__)
80
/* No pic register.  */
81
#elif defined(__sh__)
82
# define PIC_REG  "r12"
83
#elif defined(__x86_64__)
84
/* No pic register.  */
85
#elif defined(__m32c__)
86
/* No pic register.  */
87
#elif defined(__SPU__)
88
#  define PIC_REG  "126"
89
#elif defined (__frv__)
90
# ifdef __FRV_FDPIC__
91
#  define PIC_REG "gr15"
92
# else
93
#  define PIC_REG "gr17"
94
#endif
95
#else
96
# error "Modify the test for your target."
97
#endif
98
 
99
#if defined PIC_REG && !defined __PIC__ && !defined __pic__
100
register void *reg __asm__(PIC_REG);
101
#else
102
/* We really need a global register variable set to the PIC register
103
   to expose the bug.  Oh well, let the test case not fail.  */
104
static void *reg;
105
#endif
106
 
107
void * __attribute__((noinline))
108
dummy (void *x)
109
{
110
  return x;
111
}
112
 
113
void
114
f (void)
115
{
116
  goto *dummy (&&bar);
117
  for (;;)
118
    {
119
    foo:
120
      reg = (void *) 1;
121
      if (!reg)
122
        goto baz;
123
      reg = &&foo;
124
    }
125
 
126
 bar:
127
 baz:
128
  reg = 0;
129
}
130
 
131
int
132
main()
133
{
134
  void *old_reg = reg;
135
  reg = (void *) 1;
136
 
137
  f ();
138
 
139
  /* Additionally test that the prologue/epilogue properly does *not*
140
     save and restore global registers.  Not possible when the PIC
141
     register is in a register window, of course.  On Darwin, you can't
142
     call library routines from non-PIC code.  */
143
#if !defined (__sparc__) && !defined(__MACH__)
144
  if (reg)
145
    abort ();
146
#endif
147
 
148
  reg = old_reg;
149
  return 0;
150
}

powered by: WebSVN 2.1.0

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