aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/tree-ssa/restrict2.C
blob: 35957f53541964957ed7789f2b854e6c9b67267d (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// { dg-do compile }
// { dg-options "-O2 -fdump-tree-optimized" }

struct S { int *__restrict p; int q; };
S s;

int
f1 (S x, S y)
{
  x.p[0] = 1;
  y.p[0] = 0;
// { dg-final { scan-tree-dump-times "return 1" 1 "optimized" } }
  return x.p[0];
}

int
f2 (S x)
{
  x.p[0] = 2;
  s.p[0] = 0;
// { dg-final { scan-tree-dump-times "return 2" 1 "optimized" } }
  return x.p[0];
}

int
f3 (S &__restrict x, S &__restrict y)
{
  x.p[0] = 3;
  y.p[0] = 0;
// { dg-final { scan-tree-dump-times "return 3" 1 "optimized" } }
  return x.p[0];
}

int
f4 (S &x, S &y)
{
  x.p[0] = 4;
  y.p[0] = 0;
// { dg-final { scan-tree-dump-times "return 4" 0 "optimized" } }
  return x.p[0];
}

int
f5 (S *__restrict x, S *__restrict y)
{
  x->p[0] = 5;
  y->p[0] = 0;
// We might handle this some day
// { dg-final { scan-tree-dump-times "return 5" 1 "optimized" { xfail *-*-* } } }
  return x->p[0];
}

int
f6 (S *x, S *y)
{
  x->p[0] = 6;
  y->p[0] = 0;
// { dg-final { scan-tree-dump-times "return 6" 0 "optimized" } }
  return x->p[0];
}

// { dg-final { cleanup-tree-dump "optimized" } }