@@ -26,111 +26,127 @@ program omp_examples
2626 type (tt) :: values(n), sum, prod, big, small
2727
2828 ! $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
3030! 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+
3941 ! $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
4143! 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+
5054 ! $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)
5256! 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+
6167 ! $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)
6369! 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+
7280 call random_number (values% r)
7381
7482 sum% r = 0
7583 ! $omp parallel do reduction(+:sum)
76- ! CHECK: !$OMP PARALLEL DO REDUCTION(+: sum)
84+ ! CHECK: !$OMP PARALLEL DO REDUCTION(+: sum)
85+
7786! 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+
8595 do i = 1 , n
8696 sum% r = sum% r + values(i)% r
8797 end do
8898
8999 prod% r = 1
90100 ! $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+
100112 do i = 1 , n
101113 prod% r = prod% r * (values(i)% r+0.6 )
102114 end do
103115
104116 big% r = 0
105117 ! $omp parallel do reduction(max:big)
106- ! CHECK: $OMP PARALLEL DO REDUCTION(max: big)
118+ ! CHECK: $OMP PARALLEL DO REDUCTION(max: big)
119+
107120! 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+
115129 do i = 1 , n
116130 big = mymax(values(i), big)
117131 end do
118132
119133 small% r = 1
120134 ! $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+
130146 do i = 1 , n
131147 small% r = min (values(i)% r, small% r)
132148 end do
133-
149+
134150 print * , values% r
135151 print * , " sum=" , sum% r
136152 print * , " prod=" , prod% r
0 commit comments