repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
C++: simplify output from suggest_alternatives_for
[official-gcc.git]
/
libgomp
/
testsuite
/
libgomp.oacc-c-c++-common
/
declare-2.c
blob
d212458dada960847694a2b06278f9dfcf5ed224
1
#include <stdlib.h>
2
3
#define N 16
4
5
float
c
[
N
];
6
#pragma acc declare device_resident (c)
7
8
#pragma acc routine
9
float
10
subr2
(
float
a
)
11
{
12
int
i
;
13
14
for
(
i
=
0
;
i
<
N
;
i
++)
15
c
[
i
] =
2.0
;
16
17
for
(
i
=
0
;
i
<
N
;
i
++)
18
a
+=
c
[
i
];
19
20
return
a
;
21
}
22
23
float
b
[
N
];
24
#pragma acc declare copyin (b)
25
26
#pragma acc routine
27
float
28
subr1
(
float
a
)
29
{
30
int
i
;
31
32
for
(
i
=
0
;
i
<
N
;
i
++)
33
a
+=
b
[
i
];
34
35
return
a
;
36
}
37
38
int
39
main
(
int
argc
,
char
**
argv
)
40
{
41
float
a
;
42
int
i
;
43
44
for
(
i
=
0
;
i
<
16
;
i
++)
45
b
[
i
] =
1.0
;
46
47
a
=
0.0
;
48
49
a
=
subr1
(
a
);
50
51
if
(
a
!=
16.0
)
52
abort
();
53
54
a
=
0.0
;
55
56
a
=
subr2
(
a
);
57
58
if
(
a
!=
32.0
)
59
abort
();
60
61
return
0
;
62
}