Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
0e65fd7d
Commit
0e65fd7d
authored
9 years ago
by
Jakub Jelinek
Committed by
Jakub Jelinek
9 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* testsuite/libgomp.c/target-35.c: New test.
From-SVN: r230926
parent
e82f9ef7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
133 additions
and
0 deletions
+133
-0
libgomp/ChangeLog
+4
-0
libgomp/testsuite/libgomp.c/target-35.c
+129
-0
No files found.
libgomp/ChangeLog
View file @
0e65fd7d
2015-11-26 Jakub Jelinek <jakub@redhat.com>
* testsuite/libgomp.c/target-35.c: New test.
2015-11-22 James Norris <jnorris@codesourcery.com>
Cesar Philippidis <cesar@codesourcery.com>
...
...
This diff is collapsed.
Click to expand it.
libgomp/testsuite/libgomp.c/target-35.c
0 → 100644
View file @
0e65fd7d
#include <omp.h>
#include <stdlib.h>
#pragma omp declare target
__attribute__
((
noinline
))
void
foo
(
int
x
,
int
y
,
int
z
,
int
*
a
,
int
*
b
)
{
if
(
x
==
0
)
{
int
i
,
j
;
for
(
i
=
0
;
i
<
64
;
i
++
)
#pragma omp parallel for shared (a, b)
for
(
j
=
0
;
j
<
32
;
j
++
)
foo
(
3
,
i
,
j
,
a
,
b
);
}
else
if
(
x
==
1
)
{
int
i
,
j
;
#pragma omp distribute dist_schedule (static, 1)
for
(
i
=
0
;
i
<
64
;
i
++
)
#pragma omp parallel for shared (a, b)
for
(
j
=
0
;
j
<
32
;
j
++
)
foo
(
3
,
i
,
j
,
a
,
b
);
}
else
if
(
x
==
2
)
{
int
j
;
#pragma omp parallel for shared (a, b)
for
(
j
=
0
;
j
<
32
;
j
++
)
foo
(
3
,
y
,
j
,
a
,
b
);
}
else
{
#pragma omp atomic
b
[
y
]
+=
z
;
#pragma omp atomic
*
a
+=
1
;
}
}
__attribute__
((
noinline
))
int
bar
(
int
x
,
int
y
,
int
z
)
{
int
a
,
b
[
64
],
i
;
a
=
8
;
for
(
i
=
0
;
i
<
64
;
i
++
)
b
[
i
]
=
i
;
foo
(
x
,
y
,
z
,
&
a
,
b
);
if
(
x
==
0
)
{
if
(
a
!=
8
+
64
*
32
)
return
1
;
for
(
i
=
0
;
i
<
64
;
i
++
)
if
(
b
[
i
]
!=
i
+
31
*
32
/
2
)
return
1
;
}
else
if
(
x
==
1
)
{
int
c
=
omp_get_num_teams
();
int
d
=
omp_get_team_num
();
int
e
=
d
;
int
f
=
0
;
for
(
i
=
0
;
i
<
64
;
i
++
)
if
(
i
==
e
)
{
if
(
b
[
i
]
!=
i
+
31
*
32
/
2
)
return
1
;
f
++
;
e
=
e
+
c
;
}
else
if
(
b
[
i
]
!=
i
)
return
1
;
if
(
a
<
8
||
a
>
8
+
f
*
32
)
return
1
;
}
else
if
(
x
==
2
)
{
if
(
a
!=
8
+
32
)
return
1
;
for
(
i
=
0
;
i
<
64
;
i
++
)
if
(
b
[
i
]
!=
i
+
(
i
==
y
?
31
*
32
/
2
:
0
))
return
1
;
}
else
if
(
x
==
3
)
{
if
(
a
!=
8
+
1
)
return
1
;
for
(
i
=
0
;
i
<
64
;
i
++
)
if
(
b
[
i
]
!=
i
+
(
i
==
y
?
z
:
0
))
return
1
;
}
return
0
;
}
#pragma omp end declare target
int
main
()
{
int
i
,
j
,
err
=
0
;
#pragma omp target map(tofrom:err)
#pragma omp teams reduction(+:err)
err
+=
bar
(
0
,
0
,
0
);
if
(
err
)
abort
();
#pragma omp target map(tofrom:err)
#pragma omp teams reduction(+:err)
err
+=
bar
(
1
,
0
,
0
);
if
(
err
)
abort
();
#pragma omp target map(tofrom:err)
#pragma omp teams reduction(+:err)
#pragma omp distribute
for
(
i
=
0
;
i
<
64
;
i
++
)
err
+=
bar
(
2
,
i
,
0
);
if
(
err
)
abort
();
#pragma omp target map(tofrom:err)
#pragma omp teams reduction(+:err)
#pragma omp distribute
for
(
i
=
0
;
i
<
64
;
i
++
)
#pragma omp parallel for reduction(+:err)
for
(
j
=
0
;
j
<
32
;
j
++
)
err
+=
bar
(
3
,
i
,
j
);
if
(
err
)
abort
();
return
0
;
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment