@@ -26,111 +26,127 @@ program omp_examples
26
26
type (tt) :: values(n), sum, prod, big, small
27
27
28
28
! $omp declare reduction(+:tt:omp_out%r = omp_out%r + omp_in%r) initializer(omp_priv%r = 0)
29
- ! CHECK: !$OMP DECLARE REDUCTION (+:tt: omp_out%r=omp_out%r+omp_in%r
29
+ ! CHECK: !$OMP DECLARE REDUCTION(+:tt: omp_out%r=omp_out%r+omp_in%r
30
30
! CHECK-NEXT: ) INITIALIZER(omp_priv%r=0_4)
31
- ! PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OpenMPDeclareReductionConstruct
32
- ! PARSE-TREE: Verbatim
33
- ! PARSE-TREE: OmpReductionSpecifier
34
- ! PARSE-TREE-NEXT: OmpReductionIdentifier -> DefinedOperator -> IntrinsicOperator = Add
35
- ! PARSE-TREE: OmpTypeNameList -> OmpTypeSpecifier -> TypeSpec -> DerivedTypeSpec
36
- ! PARSE-TREE-NEXT: Name = 'tt'
37
- ! PARSE-TREE: OmpReductionCombiner -> AssignmentStmt = 'omp_out%r=omp_out%r+omp_in%r'
38
- ! PARSE-TREE: OmpClauseList -> OmpClause -> Initializer -> OmpInitializerClause -> AssignmentStmt = 'omp_priv%r=0._4
31
+
32
+ ! PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OpenMPDeclareReductionConstruct -> OmpDirectiveSpecification
33
+ ! PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = declare reduction
34
+ ! PARSE-TREE: | OmpArgumentList -> OmpArgument -> OmpReductionSpecifier
35
+ ! PARSE-TREE: | | OmpReductionIdentifier -> DefinedOperator -> IntrinsicOperator = Add
36
+ ! PARSE-TREE: | | OmpTypeNameList -> OmpTypeSpecifier -> TypeSpec -> DerivedTypeSpec
37
+ ! PARSE-TREE: | | | Name = 'tt'
38
+ ! PARSE-TREE: | | OmpReductionCombiner -> AssignmentStmt = 'omp_out%r=omp_out%r+omp_in%r'
39
+ ! PARSE-TREE: | OmpClauseList -> OmpClause -> Initializer -> OmpInitializerClause -> AssignmentStmt = 'omp_priv%r=0._4'
40
+
39
41
! $omp declare reduction(*:tt:omp_out%r = omp_out%r * omp_in%r) initializer(omp_priv%r = 1)
40
- ! CHECK-NEXT: !$OMP DECLARE REDUCTION (*:tt: omp_out%r=omp_out%r*omp_in%r
42
+ ! CHECK-NEXT: !$OMP DECLARE REDUCTION(*:tt: omp_out%r=omp_out%r*omp_in%r
41
43
! CHECK-NEXT: ) INITIALIZER(omp_priv%r=1_4)
42
- ! PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OpenMPDeclareReductionConstruct
43
- ! PARSE-TREE: Verbatim
44
- ! PARSE-TREE: OmpReductionSpecifier
45
- ! PARSE-TREE: OmpReductionIdentifier -> DefinedOperator -> IntrinsicOperator = Multiply
46
- ! PARSE-TREE: OmpTypeNameList -> OmpTypeSpecifier -> TypeSpec -> DerivedTypeSpec
47
- ! PARSE-TREE-NEXT: Name = 'tt'
48
- ! PARSE-TREE: OmpReductionCombiner -> AssignmentStmt = 'omp_out%r=omp_out%r*omp_in%r'
49
- ! PARSE-TREE: OmpClauseList -> OmpClause -> Initializer -> OmpInitializerClause -> AssignmentStmt = 'omp_priv%r=1._4'
44
+
45
+ ! PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OpenMPDeclareReductionConstruct -> OmpDirectiveSpecification
46
+ ! PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = declare reduction
47
+ ! PARSE-TREE: | OmpArgumentList -> OmpArgument -> OmpReductionSpecifier
48
+ ! PARSE-TREE: | | OmpReductionIdentifier -> DefinedOperator -> IntrinsicOperator = Multiply
49
+ ! PARSE-TREE: | | OmpTypeNameList -> OmpTypeSpecifier -> TypeSpec -> DerivedTypeSpec
50
+ ! PARSE-TREE: | | | Name = 'tt'
51
+ ! PARSE-TREE: | | OmpReductionCombiner -> AssignmentStmt = 'omp_out%r=omp_out%r*omp_in%r'
52
+ ! PARSE-TREE: | OmpClauseList -> OmpClause -> Initializer -> OmpInitializerClause -> AssignmentStmt = 'omp_priv%r=1._4'
53
+
50
54
! $omp declare reduction(max:tt:omp_out = mymax(omp_out, omp_in)) initializer(omp_priv%r = 0)
51
- ! CHECK-NEXT: !$OMP DECLARE REDUCTION (max:tt: omp_out=mymax(omp_out,omp_in)
55
+ ! CHECK-NEXT: !$OMP DECLARE REDUCTION(max:tt: omp_out=mymax(omp_out,omp_in)
52
56
! CHECK-NEXT: ) INITIALIZER(omp_priv%r=0_4)
53
- ! PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OpenMPDeclareReductionConstruct
54
- ! PARSE-TREE: Verbatim
55
- ! PARSE-TREE: OmpReductionSpecifier
56
- ! PARSE-TREE: OmpReductionIdentifier -> ProcedureDesignator -> Name = 'max'
57
- ! PARSE-TREE: OmpTypeNameList -> OmpTypeSpecifier -> TypeSpec -> DerivedTypeSpec
58
- ! PARSE-TREE: Name = 'tt'
59
- ! PARSE-TREE: OmpReductionCombiner -> AssignmentStmt = 'omp_out=mymax(omp_out,omp_in)'
60
- ! PARSE-TREE: OmpClauseList -> OmpClause -> Initializer -> OmpInitializerClause -> AssignmentStmt = 'omp_priv%r=0._4'
57
+
58
+ ! PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OpenMPDeclareReductionConstruct -> OmpDirectiveSpecification
59
+ ! PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = declare reduction
60
+ ! PARSE-TREE: | OmpArgumentList -> OmpArgument -> OmpReductionSpecifier
61
+ ! PARSE-TREE: | | OmpReductionIdentifier -> ProcedureDesignator -> Name = 'max'
62
+ ! PARSE-TREE: | | OmpTypeNameList -> OmpTypeSpecifier -> TypeSpec -> DerivedTypeSpec
63
+ ! PARSE-TREE: | | | Name = 'tt'
64
+ ! PARSE-TREE: | | OmpReductionCombiner -> AssignmentStmt = 'omp_out=mymax(omp_out,omp_in)'
65
+ ! PARSE-TREE: | OmpClauseList -> OmpClause -> Initializer -> OmpInitializerClause -> AssignmentStmt = 'omp_priv%r=0._4'
66
+
61
67
! $omp declare reduction(min:tt:omp_out%r = min(omp_out%r, omp_in%r)) initializer(omp_priv%r = 1)
62
- ! CHECK-NEXT: !$OMP DECLARE REDUCTION (min:tt: omp_out%r=min(omp_out%r,omp_in%r)
68
+ ! CHECK-NEXT: !$OMP DECLARE REDUCTION(min:tt: omp_out%r=min(omp_out%r,omp_in%r)
63
69
! CHECK-NEXT: ) INITIALIZER(omp_priv%r=1_4)
64
- ! PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OpenMPDeclareReductionConstruct
65
- ! PARSE-TREE: Verbatim
66
- ! PARSE-TREE: OmpReductionSpecifier
67
- ! PARSE-TREE: OmpReductionIdentifier -> ProcedureDesignator -> Name = 'min'
68
- ! PARSE-TREE: OmpTypeNameList -> OmpTypeSpecifier -> TypeSpec -> DerivedTypeSpec
69
- ! PARSE-TREE: Name = 'tt'
70
- ! PARSE-TREE: OmpReductionCombiner -> AssignmentStmt = 'omp_out%r=min(omp_out%r,omp_in%r)'
71
- ! PARSE-TREE: OmpClauseList -> OmpClause -> Initializer -> OmpInitializerClause -> AssignmentStmt = 'omp_priv%r=1._4'
70
+
71
+ ! PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OpenMPDeclareReductionConstruct -> OmpDirectiveSpecification
72
+ ! PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = declare reduction
73
+ ! PARSE-TREE: | OmpArgumentList -> OmpArgument -> OmpReductionSpecifier
74
+ ! PARSE-TREE: | | OmpReductionIdentifier -> ProcedureDesignator -> Name = 'min'
75
+ ! PARSE-TREE: | | OmpTypeNameList -> OmpTypeSpecifier -> TypeSpec -> DerivedTypeSpec
76
+ ! PARSE-TREE: | | | Name = 'tt'
77
+ ! PARSE-TREE: | | OmpReductionCombiner -> AssignmentStmt = 'omp_out%r=min(omp_out%r,omp_in%r)'
78
+ ! PARSE-TREE: | OmpClauseList -> OmpClause -> Initializer -> OmpInitializerClause -> AssignmentStmt = 'omp_priv%r=1._4'
79
+
72
80
call random_number (values% r)
73
81
74
82
sum% r = 0
75
83
! $omp parallel do reduction(+:sum)
76
- ! CHECK: !$OMP PARALLEL DO REDUCTION(+: sum)
84
+ ! CHECK: !$OMP PARALLEL DO REDUCTION(+: sum)
85
+
77
86
! PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPLoopConstruct
78
- ! PARSE-TREE: OmpBeginLoopDirective
79
- ! PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = parallel do
80
- ! PARSE-TREE: OmpClauseList -> OmpClause -> Reduction -> OmpReductionClause
81
- ! PARSE-TREE: Modifier -> OmpReductionIdentifier -> DefinedOperator -> IntrinsicOperator = Add
82
- ! PARSE-TREE: OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'sum
83
- ! PARSE-TREE: Flags = None
84
- ! PARSE-TREE: DoConstruct
87
+ ! PARSE-TREE: | OmpBeginLoopDirective
88
+ ! PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = parallel do
89
+ ! PARSE-TREE: | | OmpClauseList -> OmpClause -> Reduction -> OmpReductionClause
90
+ ! PARSE-TREE: | | | Modifier -> OmpReductionIdentifier -> DefinedOperator -> IntrinsicOperator = Add
91
+ ! PARSE-TREE: | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'sum'
92
+ ! PARSE-TREE: | | Flags = None
93
+ ! PARSE-TREE: | DoConstruct
94
+
85
95
do i = 1 , n
86
96
sum% r = sum% r + values(i)% r
87
97
end do
88
98
89
99
prod% r = 1
90
100
! $omp parallel do reduction(*:prod)
91
- ! CHECK: !$OMP PARALLEL DO REDUCTION(*: prod)
92
- ! PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPLoopConstruct
93
- ! PARSE-TREE: OmpBeginLoopDirective
94
- ! PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = parallel do
95
- ! PARSE-TREE: OmpClauseList -> OmpClause -> Reduction -> OmpReductionClause
96
- ! PARSE-TREE: Modifier -> OmpReductionIdentifier -> DefinedOperator -> IntrinsicOperator = Multiply
97
- ! PARSE-TREE: OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'prod'
98
- ! PARSE-TREE: Flags = None
99
- ! PARSE-TREE: DoConstruct
101
+ ! CHECK: !$OMP PARALLEL DO REDUCTION(*: prod)
102
+
103
+ ! PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPLoopConstruct
104
+ ! PARSE-TREE: | OmpBeginLoopDirective
105
+ ! PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = parallel do
106
+ ! PARSE-TREE: | | OmpClauseList -> OmpClause -> Reduction -> OmpReductionClause
107
+ ! PARSE-TREE: | | | Modifier -> OmpReductionIdentifier -> DefinedOperator -> IntrinsicOperator = Multiply
108
+ ! PARSE-TREE: | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'prod'
109
+ ! PARSE-TREE: | | Flags = None
110
+ ! PARSE-TREE: | DoConstruct
111
+
100
112
do i = 1 , n
101
113
prod% r = prod% r * (values(i)% r+0.6 )
102
114
end do
103
115
104
116
big% r = 0
105
117
! $omp parallel do reduction(max:big)
106
- ! CHECK: $OMP PARALLEL DO REDUCTION(max: big)
118
+ ! CHECK: $OMP PARALLEL DO REDUCTION(max: big)
119
+
107
120
! PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPLoopConstruct
108
- ! PARSE-TREE: OmpBeginLoopDirective
109
- ! PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = parallel do
110
- ! PARSE-TREE: OmpClauseList -> OmpClause -> Reduction -> OmpReductionClause
111
- ! PARSE-TREE: Modifier -> OmpReductionIdentifier -> ProcedureDesignator -> Name = 'max'
112
- ! PARSE-TREE: OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'big'
113
- ! PARSE-TREE: Flags = None
114
- ! PARSE-TREE: DoConstruct
121
+ ! PARSE-TREE: | OmpBeginLoopDirective
122
+ ! PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = parallel do
123
+ ! PARSE-TREE: | | OmpClauseList -> OmpClause -> Reduction -> OmpReductionClause
124
+ ! PARSE-TREE: | | | Modifier -> OmpReductionIdentifier -> ProcedureDesignator -> Name = 'max'
125
+ ! PARSE-TREE: | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'big'
126
+ ! PARSE-TREE: | | Flags = None
127
+ ! PARSE-TREE: | DoConstruct
128
+
115
129
do i = 1 , n
116
130
big = mymax(values(i), big)
117
131
end do
118
132
119
133
small% r = 1
120
134
! $omp parallel do reduction(min:small)
121
- ! CHECK: !$OMP PARALLEL DO REDUCTION(min: small)
122
- ! CHECK-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPLoopConstruct
123
- ! CHECK-TREE: OmpBeginLoopDirective
124
- ! CHECK-TREE: OmpDirectiveName -> llvm::omp::Directive = parallel do
125
- ! CHECK-TREE: OmpClauseList -> OmpClause -> Reduction -> OmpReductionClause
126
- ! CHECK-TREE: Modifier -> OmpReductionIdentifier -> ProcedureDesignator -> Name = 'min'
127
- ! CHECK-TREE: OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'small'
128
- ! PARSE-TREE: Flags = None
129
- ! CHECK-TREE: DoConstruct
135
+ ! CHECK: !$OMP PARALLEL DO REDUCTION(min: small)
136
+
137
+ ! PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPLoopConstruct
138
+ ! PARSE-TREE: | OmpBeginLoopDirective
139
+ ! PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = parallel do
140
+ ! PARSE-TREE: | | OmpClauseList -> OmpClause -> Reduction -> OmpReductionClause
141
+ ! PARSE-TREE: | | | Modifier -> OmpReductionIdentifier -> ProcedureDesignator -> Name = 'min'
142
+ ! PARSE-TREE: | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'small'
143
+ ! PARSE-TREE: | | Flags = None
144
+ ! PARSE-TREE: | DoConstruct
145
+
130
146
do i = 1 , n
131
147
small% r = min (values(i)% r, small% r)
132
148
end do
133
-
149
+
134
150
print * , values% r
135
151
print * , " sum=" , sum% r
136
152
print * , " prod=" , prod% r
0 commit comments