LLVM OpenMP
20.0.0git
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
c
d
e
g
h
i
m
n
p
r
s
t
u
Functions
c
d
e
g
i
m
n
p
r
s
u
Variables
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
w
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
Enumerations
Enumerator
Related Functions
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Typedefs
_
a
b
c
d
e
i
k
l
m
n
o
p
r
t
u
Enumerations
_
b
c
d
f
k
l
n
o
s
t
Enumerator
_
a
b
c
d
e
f
k
l
n
o
p
r
s
t
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
runtime
test
parallel
omp_parallel_if.c
Go to the documentation of this file.
1
// RUN: %libomp-compile-and-run
2
// RUN: %libomp-irbuilder-compile-and-run
3
4
// irbuilder is only available with clang
5
// REQUIRES: clang
6
7
#include <stdio.h>
8
#include "
omp_testsuite.h
"
9
10
int
test_omp_parallel_if
()
11
{
12
int
i
;
13
int
sum
;
14
int
known_sum;
15
int
mysum;
16
int
control=1;
17
18
sum
=0;
19
known_sum = (
LOOPCOUNT
* (
LOOPCOUNT
+ 1)) / 2 ;
20
#pragma omp parallel private(i) if(control==0)
21
{
22
mysum = 0;
23
for
(
i
= 1;
i
<=
LOOPCOUNT
;
i
++) {
24
mysum = mysum +
i
;
25
}
26
#pragma omp critical
27
{
28
sum
=
sum
+ mysum;
29
}
30
}
31
return
(known_sum ==
sum
);
32
}
33
34
int
main
()
35
{
36
int
i
;
37
int
num_failed=0;
38
39
for
(
i
= 0;
i
<
REPETITIONS
;
i
++) {
40
if
(!
test_omp_parallel_if
()) {
41
num_failed++;
42
}
43
}
44
return
num_failed;
45
}
i
#define i
Definition:
kmp_stub.cpp:87
sum
int sum
Definition:
omp_for_schedule_runtime.c:19
test_omp_parallel_if
int test_omp_parallel_if()
Definition:
omp_parallel_if.c:10
main
int main()
Definition:
omp_parallel_if.c:34
omp_testsuite.h
LOOPCOUNT
#define LOOPCOUNT
Definition:
omp_testsuite.h:12
REPETITIONS
#define REPETITIONS
Definition:
omp_testsuite.h:13
Generated on Thu Jun 5 2025 04:45:56 for LLVM OpenMP by
1.9.6