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

Subversion Repositories openrisc

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

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

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

powered by: WebSVN 2.1.0

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