aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/xtensa/pr108919.c
blob: 300b6fd10a9923addaccdc4074258274390b4c0a (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
44
45
46
/* { dg-do run } */
/* { dg-options "-O2" } */


#ifdef __XTENSA_CALL0_ABI__
void __xtensa_libgcc_window_spill (void)
{
}
#else
void __xtensa_libgcc_window_spill (void);
#endif

__attribute__((noinline)) void h (void)
{
  __xtensa_libgcc_window_spill ();
}

int f (int u, int v)
{
  int a = u;
  int s;

  __attribute__((noinline,pure)) int nested1 (int b)
  {
      h();
      return a + b;
  }

  __attribute__((noinline,pure)) int nested2 (int b)
  {
      h();
      return a - b;
  }

  s = nested1 (v);
  s += nested2 (v);
  return s;
}

int main (void)
{
  int u = 0x12345678;
  int v = 1;

  return f (u, v) == 2 * u ? 0 : 1;
}