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.misc-tests/] [bprob-2.c] - Blame information for rev 310

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

Line No. Rev Author Line
1 299 jeremybenn
/* Test profile-directed block ordering with computed gotos.
2
 *
3
   This is the same as test gcc.c-torture/execute/980526-1.c and
4
   gcc.misc-tests/gcov-3.c */
5
 
6
extern void abort (void);
7
extern void exit (int);
8
 
9
int expect_do1 = 1, expect_do2 = 2;
10
 
11
static int doit(int x){
12
  __label__ lbl1;
13
  __label__ lbl2;
14
  static int jtab_init = 0;
15
  static void *jtab[2];
16
 
17
  if(!jtab_init) {
18
    jtab[0] = &&lbl1;
19
    jtab[1] = &&lbl2;
20
    jtab_init = 1;
21
  }
22
  goto *jtab[x];
23
lbl1:
24
  return 1;
25
lbl2:
26
  return 2;
27
}
28
 
29
static void do1(void) {
30
  if (doit(0) != expect_do1)
31
    abort ();
32
}
33
 
34
static void do2(void){
35
  if (doit(1) != expect_do2)
36
    abort ();
37
}
38
 
39
int main(void){
40
#ifndef NO_LABEL_VALUES
41
  do1();
42
  do2();
43
#endif
44
  exit(0);
45
}

powered by: WebSVN 2.1.0

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