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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgomp/] [testsuite/] [libgomp.c++/] [for-7.C] - Blame information for rev 735

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 735 jeremybenn
// PR c++/
2
// { dg-do run }
3
// { dg-options "-std=c++0x -fopenmp" }
4
 
5
extern "C" void abort ();
6
int cnt;
7
 
8
template 
9
void
10
f0 (T, int)
11
{
12
  abort ();
13
}
14
 
15
template <>
16
void
17
f0 (int, int type)
18
{
19
  if (type != 0)
20
    abort ();
21
#pragma omp atomic
22
  cnt++;
23
}
24
 
25
template <>
26
void
27
f0 (const char *, int type)
28
{
29
  if (type != 1)
30
    abort ();
31
#pragma omp atomic
32
  cnt++;
33
}
34
 
35
template 
36
void
37
f1 ()
38
{
39
#pragma omp parallel for
40
  for (auto i = 0; i < 10; i++)
41
    f0 (i, 0);
42
}
43
 
44
template 
45
void
46
f2 ()
47
{
48
#pragma omp parallel for
49
  for (auto i = T (0); i < T (10); i += T (1))
50
    f0 (i, 0);
51
}
52
 
53
void
54
f3 ()
55
{
56
#pragma omp parallel for
57
  for (auto i = 0; i < 10; i++)
58
    f0 (i, 0);
59
}
60
 
61
const char *p = "abcdefghij";
62
 
63
template 
64
void
65
f4 ()
66
{
67
#pragma omp parallel for
68
  for (auto i = p; i < p + 10; i++)
69
    f0 (i, 1);
70
}
71
 
72
template 
73
void
74
f5 ()
75
{
76
#pragma omp parallel for
77
  for (auto i = T (p); i < T (p + 10); i++)
78
    f0 (i, 1);
79
}
80
 
81
void
82
f6 ()
83
{
84
#pragma omp parallel for
85
  for (auto i = p; i < p + 10; i++)
86
    f0 (i, 1);
87
}
88
 
89
int
90
main ()
91
{
92
  f1 ();
93
  if (cnt != 10)
94
    abort ();
95
  f2 ();
96
  if (cnt != 20)
97
    abort ();
98
  f3 ();
99
  if (cnt != 30)
100
    abort ();
101
  f4 ();
102
  if (cnt != 40)
103
    abort ();
104
  f5 ();
105
  if (cnt != 50)
106
    abort ();
107
  f6 ();
108
  if (cnt != 60)
109
    abort ();
110
}

powered by: WebSVN 2.1.0

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