aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-inline-z10.c
blob: 28d7837e2a4be032f3521cd52b4b79bbbc293e3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* { dg-do run } */
/* { dg-options "-O3 -march=z10 --save-temps -mindirect-branch-jump=thunk-inline -mindirect-branch-table" } */
/* { dg-require-effective-target label_values } */

/* This is a copy of the gcc.c-torture/execute/20040302-1.c
   testcase.  */

int code[]={0,0,0,0,1};

void
foo(int x) {
  volatile int b;
  b = 0xffffffff;
}

void
bar(int *pc) {
  static const void *l[] = {&&lab0, &&end};

  foo(0);
  goto *l[*pc];
 lab0:
  foo(0);
  pc++;
  goto *l[*pc];
 end:
  return;
}

int
main() {
  bar(code);
  return 0;
}

/* The two gotos in bar get merged.  */
/* { dg-final { scan-assembler-times "exrl" 1 } } */

/* { dg-final { scan-assembler-not "jg\t__s390_indirect_jump" } } */
/* { dg-final { scan-assembler     "section\t.s390_indirect_jump" } } */
/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
/* { dg-final { scan-assembler-not "section\t.s390_return_reg" } } */
/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */