xref: /llvm-project/flang/test/Lower/OpenMP/wsloop-reduction-mul.f90 (revision 937cbce14c9aa956342a9c818c26a8a557802843)
15b66987cSKiran Chandramohan! RUN: bbc -emit-hlfir -fopenmp %s -o - | FileCheck %s
25b66987cSKiran Chandramohan! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
35b66987cSKiran Chandramohan
4be9f8ffdSDavid Truby
5be9f8ffdSDavid Truby! NOTE: Assertions have been autogenerated by utils/generate-test-checks.py
6be9f8ffdSDavid Truby
73deaa77fSTom Eccles! CHECK-LABEL:   omp.declare_reduction @multiply_reduction_f64 : f64 init {
8be9f8ffdSDavid Truby! CHECK:           %[[VAL_1:.*]] = arith.constant 1.000000e+00 : f64
9be9f8ffdSDavid Truby! CHECK:           omp.yield(%[[VAL_1]] : f64)
10be9f8ffdSDavid Truby
11be9f8ffdSDavid Truby! CHECK-LABEL:   } combiner {
12be9f8ffdSDavid Truby! CHECK:         ^bb0(%[[VAL_0:.*]]: f64, %[[VAL_1:.*]]: f64):
13be9f8ffdSDavid Truby! CHECK:           %[[VAL_2:.*]] = arith.mulf %[[VAL_0]], %[[VAL_1]] fastmath<contract> : f64
14be9f8ffdSDavid Truby! CHECK:           omp.yield(%[[VAL_2]] : f64)
155b66987cSKiran Chandramohan! CHECK:         }
165b66987cSKiran Chandramohan
173deaa77fSTom Eccles! CHECK-LABEL:   omp.declare_reduction @multiply_reduction_i64 : i64 init {
18be9f8ffdSDavid Truby! CHECK:         ^bb0(%[[VAL_0:.*]]: i64):
19be9f8ffdSDavid Truby! CHECK:           %[[VAL_1:.*]] = arith.constant 1 : i64
20be9f8ffdSDavid Truby! CHECK:           omp.yield(%[[VAL_1]] : i64)
21be9f8ffdSDavid Truby
22be9f8ffdSDavid Truby! CHECK-LABEL:   } combiner {
23be9f8ffdSDavid Truby! CHECK:         ^bb0(%[[VAL_0:.*]]: i64, %[[VAL_1:.*]]: i64):
24be9f8ffdSDavid Truby! CHECK:           %[[VAL_2:.*]] = arith.muli %[[VAL_0]], %[[VAL_1]] : i64
25be9f8ffdSDavid Truby! CHECK:           omp.yield(%[[VAL_2]] : i64)
265b66987cSKiran Chandramohan! CHECK:         }
275b66987cSKiran Chandramohan
283deaa77fSTom Eccles! CHECK-LABEL:   omp.declare_reduction @multiply_reduction_f32 : f32 init {
29be9f8ffdSDavid Truby! CHECK:         ^bb0(%[[VAL_0:.*]]: f32):
30be9f8ffdSDavid Truby! CHECK:           %[[VAL_1:.*]] = arith.constant 1.000000e+00 : f32
31be9f8ffdSDavid Truby! CHECK:           omp.yield(%[[VAL_1]] : f32)
32be9f8ffdSDavid Truby
33be9f8ffdSDavid Truby! CHECK-LABEL:   } combiner {
34be9f8ffdSDavid Truby! CHECK:         ^bb0(%[[VAL_0:.*]]: f32, %[[VAL_1:.*]]: f32):
35be9f8ffdSDavid Truby! CHECK:           %[[VAL_2:.*]] = arith.mulf %[[VAL_0]], %[[VAL_1]] fastmath<contract> : f32
36be9f8ffdSDavid Truby! CHECK:           omp.yield(%[[VAL_2]] : f32)
375b66987cSKiran Chandramohan! CHECK:         }
385b66987cSKiran Chandramohan
393deaa77fSTom Eccles! CHECK-LABEL:   omp.declare_reduction @multiply_reduction_i32 : i32 init {
40be9f8ffdSDavid Truby! CHECK:         ^bb0(%[[VAL_0:.*]]: i32):
41be9f8ffdSDavid Truby! CHECK:           %[[VAL_1:.*]] = arith.constant 1 : i32
42be9f8ffdSDavid Truby! CHECK:           omp.yield(%[[VAL_1]] : i32)
43be9f8ffdSDavid Truby
44be9f8ffdSDavid Truby! CHECK-LABEL:   } combiner {
45be9f8ffdSDavid Truby! CHECK:         ^bb0(%[[VAL_0:.*]]: i32, %[[VAL_1:.*]]: i32):
46be9f8ffdSDavid Truby! CHECK:           %[[VAL_2:.*]] = arith.muli %[[VAL_0]], %[[VAL_1]] : i32
47be9f8ffdSDavid Truby! CHECK:           omp.yield(%[[VAL_2]] : i32)
485b66987cSKiran Chandramohan! CHECK:         }
495b66987cSKiran Chandramohan
50be9f8ffdSDavid Truby! CHECK-LABEL:   func.func @_QPsimple_int_reduction() {
51be9f8ffdSDavid Truby! CHECK:           %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_int_reductionEi"}
52be9f8ffdSDavid Truby! CHECK:           %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFsimple_int_reductionEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
53be9f8ffdSDavid Truby! CHECK:           %[[VAL_2:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFsimple_int_reductionEx"}
54be9f8ffdSDavid Truby! CHECK:           %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_2]] {uniq_name = "_QFsimple_int_reductionEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
55be9f8ffdSDavid Truby! CHECK:           %[[VAL_4:.*]] = arith.constant 1 : i32
56be9f8ffdSDavid Truby! CHECK:           hlfir.assign %[[VAL_4]] to %[[VAL_3]]#0 : i32, !fir.ref<i32>
57be9f8ffdSDavid Truby! CHECK:           omp.parallel {
58*937cbce1SKareem Ergawy! CHECK:             %[[VAL_5:.*]] = fir.alloca i32 {bindc_name = "i", pinned, {{.*}}}
59*937cbce1SKareem Ergawy! CHECK:             %[[VAL_6:.*]]:2 = hlfir.declare %[[VAL_5]] {uniq_name = "_QFsimple_int_reductionEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
60be9f8ffdSDavid Truby! CHECK:             %[[VAL_7:.*]] = arith.constant 1 : i32
61be9f8ffdSDavid Truby! CHECK:             %[[VAL_8:.*]] = arith.constant 10 : i32
62be9f8ffdSDavid Truby! CHECK:             %[[VAL_9:.*]] = arith.constant 1 : i32
63*937cbce1SKareem Ergawy! CHECK:             omp.wsloop reduction(@multiply_reduction_i32 %[[VAL_3]]#0 -> %[[VAL_10:.*]] : !fir.ref<i32>) {
64ca4dbc27SSergio Afonso! CHECK-NEXT:          omp.loop_nest (%[[VAL_11:.*]]) : i32 = (%[[VAL_7]]) to (%[[VAL_8]]) inclusive step (%[[VAL_9]]) {
65be9f8ffdSDavid Truby! CHECK:                 %[[VAL_12:.*]]:2 = hlfir.declare %[[VAL_10]] {uniq_name = "_QFsimple_int_reductionEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
66ca4dbc27SSergio Afonso! CHECK:                 fir.store %[[VAL_11]] to %[[VAL_6]]#1 : !fir.ref<i32>
67be9f8ffdSDavid Truby! CHECK:                 %[[VAL_13:.*]] = fir.load %[[VAL_12]]#0 : !fir.ref<i32>
68be9f8ffdSDavid Truby! CHECK:                 %[[VAL_14:.*]] = fir.load %[[VAL_6]]#0 : !fir.ref<i32>
69be9f8ffdSDavid Truby! CHECK:                 %[[VAL_15:.*]] = arith.muli %[[VAL_13]], %[[VAL_14]] : i32
70be9f8ffdSDavid Truby! CHECK:                 hlfir.assign %[[VAL_15]] to %[[VAL_12]]#0 : i32, !fir.ref<i32>
715b66987cSKiran Chandramohan! CHECK:                 omp.yield
725b66987cSKiran Chandramohan! CHECK:             omp.terminator
735b66987cSKiran Chandramohan! CHECK:           return
745b66987cSKiran Chandramohan
755b66987cSKiran Chandramohansubroutine simple_int_reduction
765b66987cSKiran Chandramohan  integer :: x
775b66987cSKiran Chandramohan  x = 1
785b66987cSKiran Chandramohan  !$omp parallel
795b66987cSKiran Chandramohan  !$omp do reduction(*:x)
805b66987cSKiran Chandramohan  do i=1, 10
815b66987cSKiran Chandramohan    x = x * i
825b66987cSKiran Chandramohan  end do
835b66987cSKiran Chandramohan  !$omp end do
845b66987cSKiran Chandramohan  !$omp end parallel
855b66987cSKiran Chandramohanend subroutine
865b66987cSKiran Chandramohan
87be9f8ffdSDavid Truby! CHECK-LABEL:   func.func @_QPsimple_real_reduction() {
88be9f8ffdSDavid Truby! CHECK:           %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_real_reductionEi"}
89be9f8ffdSDavid Truby! CHECK:           %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFsimple_real_reductionEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
90be9f8ffdSDavid Truby! CHECK:           %[[VAL_2:.*]] = fir.alloca f32 {bindc_name = "x", uniq_name = "_QFsimple_real_reductionEx"}
91be9f8ffdSDavid Truby! CHECK:           %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_2]] {uniq_name = "_QFsimple_real_reductionEx"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
92be9f8ffdSDavid Truby! CHECK:           %[[VAL_4:.*]] = arith.constant 1.000000e+00 : f32
93be9f8ffdSDavid Truby! CHECK:           hlfir.assign %[[VAL_4]] to %[[VAL_3]]#0 : f32, !fir.ref<f32>
94be9f8ffdSDavid Truby! CHECK:           omp.parallel {
95*937cbce1SKareem Ergawy! CHECK:             %[[VAL_5:.*]] = fir.alloca i32 {bindc_name = "i", pinned, {{.*}}}
96*937cbce1SKareem Ergawy! CHECK:             %[[VAL_6:.*]]:2 = hlfir.declare %[[VAL_5]] {uniq_name = "_QFsimple_real_reductionEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
97be9f8ffdSDavid Truby! CHECK:             %[[VAL_7:.*]] = arith.constant 1 : i32
98be9f8ffdSDavid Truby! CHECK:             %[[VAL_8:.*]] = arith.constant 10 : i32
99be9f8ffdSDavid Truby! CHECK:             %[[VAL_9:.*]] = arith.constant 1 : i32
100*937cbce1SKareem Ergawy! CHECK:             omp.wsloop reduction(@multiply_reduction_f32 %[[VAL_3]]#0 -> %[[VAL_10:.*]] : !fir.ref<f32>) {
101ca4dbc27SSergio Afonso! CHECK-NEXT:          omp.loop_nest (%[[VAL_11:.*]]) : i32 = (%[[VAL_7]]) to (%[[VAL_8]]) inclusive step (%[[VAL_9]]) {
102be9f8ffdSDavid Truby! CHECK:                 %[[VAL_12:.*]]:2 = hlfir.declare %[[VAL_10]] {uniq_name = "_QFsimple_real_reductionEx"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
103ca4dbc27SSergio Afonso! CHECK:                 fir.store %[[VAL_11]] to %[[VAL_6]]#1 : !fir.ref<i32>
104be9f8ffdSDavid Truby! CHECK:                 %[[VAL_13:.*]] = fir.load %[[VAL_12]]#0 : !fir.ref<f32>
105be9f8ffdSDavid Truby! CHECK:                 %[[VAL_14:.*]] = fir.load %[[VAL_6]]#0 : !fir.ref<i32>
106be9f8ffdSDavid Truby! CHECK:                 %[[VAL_15:.*]] = fir.convert %[[VAL_14]] : (i32) -> f32
107be9f8ffdSDavid Truby! CHECK:                 %[[VAL_16:.*]] = arith.mulf %[[VAL_13]], %[[VAL_15]] fastmath<contract> : f32
108be9f8ffdSDavid Truby! CHECK:                 hlfir.assign %[[VAL_16]] to %[[VAL_12]]#0 : f32, !fir.ref<f32>
1095b66987cSKiran Chandramohan! CHECK:                 omp.yield
1105b66987cSKiran Chandramohan! CHECK:             omp.terminator
1115b66987cSKiran Chandramohan! CHECK:           return
112be9f8ffdSDavid Truby
1135b66987cSKiran Chandramohansubroutine simple_real_reduction
1145b66987cSKiran Chandramohan  real :: x
1155b66987cSKiran Chandramohan  x = 1.0
1165b66987cSKiran Chandramohan  !$omp parallel
1175b66987cSKiran Chandramohan  !$omp do reduction(*:x)
1185b66987cSKiran Chandramohan  do i=1, 10
1195b66987cSKiran Chandramohan    x = x * i
1205b66987cSKiran Chandramohan  end do
1215b66987cSKiran Chandramohan  !$omp end do
1225b66987cSKiran Chandramohan  !$omp end parallel
1235b66987cSKiran Chandramohanend subroutine
1245b66987cSKiran Chandramohan
125be9f8ffdSDavid Truby! CHECK-LABEL:   func.func @_QPsimple_int_reduction_switch_order() {
126be9f8ffdSDavid Truby! CHECK:           %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_int_reduction_switch_orderEi"}
127be9f8ffdSDavid Truby! CHECK:           %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFsimple_int_reduction_switch_orderEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
128be9f8ffdSDavid Truby! CHECK:           %[[VAL_2:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFsimple_int_reduction_switch_orderEx"}
129be9f8ffdSDavid Truby! CHECK:           %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_2]] {uniq_name = "_QFsimple_int_reduction_switch_orderEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
130be9f8ffdSDavid Truby! CHECK:           %[[VAL_4:.*]] = arith.constant 1 : i32
131be9f8ffdSDavid Truby! CHECK:           hlfir.assign %[[VAL_4]] to %[[VAL_3]]#0 : i32, !fir.ref<i32>
132be9f8ffdSDavid Truby! CHECK:           omp.parallel {
133*937cbce1SKareem Ergawy! CHECK:             %[[VAL_5:.*]] = fir.alloca i32 {bindc_name = "i", pinned, {{.*}}}
134*937cbce1SKareem Ergawy! CHECK:             %[[VAL_6:.*]]:2 = hlfir.declare %[[VAL_5]] {uniq_name = "_QFsimple_int_reduction_switch_orderEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
135be9f8ffdSDavid Truby! CHECK:             %[[VAL_7:.*]] = arith.constant 1 : i32
136be9f8ffdSDavid Truby! CHECK:             %[[VAL_8:.*]] = arith.constant 10 : i32
137be9f8ffdSDavid Truby! CHECK:             %[[VAL_9:.*]] = arith.constant 1 : i32
138*937cbce1SKareem Ergawy! CHECK:             omp.wsloop reduction(@multiply_reduction_i32 %[[VAL_3]]#0 -> %[[VAL_10:.*]] : !fir.ref<i32>) {
139ca4dbc27SSergio Afonso! CHECK-NEXT:          omp.loop_nest (%[[VAL_11:.*]]) : i32 = (%[[VAL_7]]) to (%[[VAL_8]]) inclusive step (%[[VAL_9]]) {
140be9f8ffdSDavid Truby! CHECK:                 %[[VAL_12:.*]]:2 = hlfir.declare %[[VAL_10]] {uniq_name = "_QFsimple_int_reduction_switch_orderEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
141ca4dbc27SSergio Afonso! CHECK:                 fir.store %[[VAL_11]] to %[[VAL_6]]#1 : !fir.ref<i32>
142be9f8ffdSDavid Truby! CHECK:                 %[[VAL_13:.*]] = fir.load %[[VAL_6]]#0 : !fir.ref<i32>
143be9f8ffdSDavid Truby! CHECK:                 %[[VAL_14:.*]] = fir.load %[[VAL_12]]#0 : !fir.ref<i32>
144be9f8ffdSDavid Truby! CHECK:                 %[[VAL_15:.*]] = arith.muli %[[VAL_13]], %[[VAL_14]] : i32
145be9f8ffdSDavid Truby! CHECK:                 hlfir.assign %[[VAL_15]] to %[[VAL_12]]#0 : i32, !fir.ref<i32>
1465b66987cSKiran Chandramohan! CHECK:                 omp.yield
1475b66987cSKiran Chandramohan! CHECK:             omp.terminator
1485b66987cSKiran Chandramohan! CHECK:           return
149be9f8ffdSDavid Truby
1505b66987cSKiran Chandramohansubroutine simple_int_reduction_switch_order
1515b66987cSKiran Chandramohan  integer :: x
1525b66987cSKiran Chandramohan  x = 1
1535b66987cSKiran Chandramohan  !$omp parallel
1545b66987cSKiran Chandramohan  !$omp do reduction(*:x)
1555b66987cSKiran Chandramohan  do i=1, 10
1565b66987cSKiran Chandramohan  x = i * x
1575b66987cSKiran Chandramohan  end do
1585b66987cSKiran Chandramohan  !$omp end do
1595b66987cSKiran Chandramohan  !$omp end parallel
1605b66987cSKiran Chandramohanend subroutine
1615b66987cSKiran Chandramohan
162be9f8ffdSDavid Truby! CHECK-LABEL:   func.func @_QPsimple_real_reduction_switch_order() {
163be9f8ffdSDavid Truby! CHECK:           %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFsimple_real_reduction_switch_orderEi"}
164be9f8ffdSDavid Truby! CHECK:           %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFsimple_real_reduction_switch_orderEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
165be9f8ffdSDavid Truby! CHECK:           %[[VAL_2:.*]] = fir.alloca f32 {bindc_name = "x", uniq_name = "_QFsimple_real_reduction_switch_orderEx"}
166be9f8ffdSDavid Truby! CHECK:           %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_2]] {uniq_name = "_QFsimple_real_reduction_switch_orderEx"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
167be9f8ffdSDavid Truby! CHECK:           %[[VAL_4:.*]] = arith.constant 1.000000e+00 : f32
168be9f8ffdSDavid Truby! CHECK:           hlfir.assign %[[VAL_4]] to %[[VAL_3]]#0 : f32, !fir.ref<f32>
169be9f8ffdSDavid Truby! CHECK:           omp.parallel {
170*937cbce1SKareem Ergawy! CHECK:             %[[VAL_5:.*]] = fir.alloca i32 {bindc_name = "i", pinned, {{.*}}}
171*937cbce1SKareem Ergawy! CHECK:             %[[VAL_6:.*]]:2 = hlfir.declare %[[VAL_5]] {uniq_name = "_QFsimple_real_reduction_switch_orderEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
172be9f8ffdSDavid Truby! CHECK:             %[[VAL_7:.*]] = arith.constant 1 : i32
173be9f8ffdSDavid Truby! CHECK:             %[[VAL_8:.*]] = arith.constant 10 : i32
174be9f8ffdSDavid Truby! CHECK:             %[[VAL_9:.*]] = arith.constant 1 : i32
175*937cbce1SKareem Ergawy! CHECK:             omp.wsloop reduction(@multiply_reduction_f32 %[[VAL_3]]#0 -> %[[VAL_10:.*]] : !fir.ref<f32>) {
176ca4dbc27SSergio Afonso! CHECK-NEXT:          omp.loop_nest (%[[VAL_11:.*]]) : i32 = (%[[VAL_7]]) to (%[[VAL_8]]) inclusive step (%[[VAL_9]]) {
177be9f8ffdSDavid Truby! CHECK:                 %[[VAL_12:.*]]:2 = hlfir.declare %[[VAL_10]] {uniq_name = "_QFsimple_real_reduction_switch_orderEx"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
178ca4dbc27SSergio Afonso! CHECK:                 fir.store %[[VAL_11]] to %[[VAL_6]]#1 : !fir.ref<i32>
179be9f8ffdSDavid Truby! CHECK:                 %[[VAL_13:.*]] = fir.load %[[VAL_6]]#0 : !fir.ref<i32>
180be9f8ffdSDavid Truby! CHECK:                 %[[VAL_14:.*]] = fir.convert %[[VAL_13]] : (i32) -> f32
181be9f8ffdSDavid Truby! CHECK:                 %[[VAL_15:.*]] = fir.load %[[VAL_12]]#0 : !fir.ref<f32>
182be9f8ffdSDavid Truby! CHECK:                 %[[VAL_16:.*]] = arith.mulf %[[VAL_14]], %[[VAL_15]] fastmath<contract> : f32
183be9f8ffdSDavid Truby! CHECK:                 hlfir.assign %[[VAL_16]] to %[[VAL_12]]#0 : f32, !fir.ref<f32>
1845b66987cSKiran Chandramohan! CHECK:                 omp.yield
1855b66987cSKiran Chandramohan! CHECK:             omp.terminator
1865b66987cSKiran Chandramohan! CHECK:           return
187be9f8ffdSDavid Truby
1885b66987cSKiran Chandramohansubroutine simple_real_reduction_switch_order
1895b66987cSKiran Chandramohan  real :: x
1905b66987cSKiran Chandramohan  x = 1.0
1915b66987cSKiran Chandramohan  !$omp parallel
1925b66987cSKiran Chandramohan  !$omp do reduction(*:x)
1935b66987cSKiran Chandramohan  do i=1, 10
1945b66987cSKiran Chandramohan  x = i * x
1955b66987cSKiran Chandramohan  end do
1965b66987cSKiran Chandramohan  !$omp end do
1975b66987cSKiran Chandramohan  !$omp end parallel
1985b66987cSKiran Chandramohanend subroutine
1995b66987cSKiran Chandramohan
200be9f8ffdSDavid Truby! CHECK-LABEL:   func.func @_QPmultiple_int_reductions_same_type() {
201be9f8ffdSDavid Truby! CHECK:           %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFmultiple_int_reductions_same_typeEi"}
202be9f8ffdSDavid Truby! CHECK:           %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFmultiple_int_reductions_same_typeEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
203be9f8ffdSDavid Truby! CHECK:           %[[VAL_2:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFmultiple_int_reductions_same_typeEx"}
204be9f8ffdSDavid Truby! CHECK:           %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_2]] {uniq_name = "_QFmultiple_int_reductions_same_typeEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
205be9f8ffdSDavid Truby! CHECK:           %[[VAL_4:.*]] = fir.alloca i32 {bindc_name = "y", uniq_name = "_QFmultiple_int_reductions_same_typeEy"}
206be9f8ffdSDavid Truby! CHECK:           %[[VAL_5:.*]]:2 = hlfir.declare %[[VAL_4]] {uniq_name = "_QFmultiple_int_reductions_same_typeEy"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
207be9f8ffdSDavid Truby! CHECK:           %[[VAL_6:.*]] = fir.alloca i32 {bindc_name = "z", uniq_name = "_QFmultiple_int_reductions_same_typeEz"}
208be9f8ffdSDavid Truby! CHECK:           %[[VAL_7:.*]]:2 = hlfir.declare %[[VAL_6]] {uniq_name = "_QFmultiple_int_reductions_same_typeEz"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
209be9f8ffdSDavid Truby! CHECK:           %[[VAL_8:.*]] = arith.constant 1 : i32
210be9f8ffdSDavid Truby! CHECK:           hlfir.assign %[[VAL_8]] to %[[VAL_3]]#0 : i32, !fir.ref<i32>
211be9f8ffdSDavid Truby! CHECK:           %[[VAL_9:.*]] = arith.constant 1 : i32
212be9f8ffdSDavid Truby! CHECK:           hlfir.assign %[[VAL_9]] to %[[VAL_5]]#0 : i32, !fir.ref<i32>
213be9f8ffdSDavid Truby! CHECK:           %[[VAL_10:.*]] = arith.constant 1 : i32
214be9f8ffdSDavid Truby! CHECK:           hlfir.assign %[[VAL_10]] to %[[VAL_7]]#0 : i32, !fir.ref<i32>
215be9f8ffdSDavid Truby! CHECK:           omp.parallel {
216*937cbce1SKareem Ergawy! CHECK:             %[[VAL_11:.*]] = fir.alloca i32 {bindc_name = "i", pinned, {{.*}}}
217*937cbce1SKareem Ergawy! CHECK:             %[[VAL_12:.*]]:2 = hlfir.declare %[[VAL_11]] {uniq_name = "_QFmultiple_int_reductions_same_typeEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
218be9f8ffdSDavid Truby! CHECK:             %[[VAL_13:.*]] = arith.constant 1 : i32
219be9f8ffdSDavid Truby! CHECK:             %[[VAL_14:.*]] = arith.constant 10 : i32
220be9f8ffdSDavid Truby! CHECK:             %[[VAL_15:.*]] = arith.constant 1 : i32
221*937cbce1SKareem Ergawy! CHECK:             omp.wsloop reduction(@multiply_reduction_i32 %[[VAL_3]]#0 -> %[[VAL_16:.*]], @multiply_reduction_i32 %[[VAL_5]]#0 -> %[[VAL_17:.*]], @multiply_reduction_i32 %[[VAL_7]]#0 -> %[[VAL_18:.*]] : !fir.ref<i32>, !fir.ref<i32>, !fir.ref<i32>) {
222ca4dbc27SSergio Afonso! CHECK-NEXT:          omp.loop_nest (%[[VAL_19:.*]]) : i32 = (%[[VAL_13]]) to (%[[VAL_14]]) inclusive step (%[[VAL_15]]) {
223be9f8ffdSDavid Truby! CHECK:                 %[[VAL_20:.*]]:2 = hlfir.declare %[[VAL_16]] {uniq_name = "_QFmultiple_int_reductions_same_typeEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
224be9f8ffdSDavid Truby! CHECK:                 %[[VAL_21:.*]]:2 = hlfir.declare %[[VAL_17]] {uniq_name = "_QFmultiple_int_reductions_same_typeEy"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
225be9f8ffdSDavid Truby! CHECK:                 %[[VAL_22:.*]]:2 = hlfir.declare %[[VAL_18]] {uniq_name = "_QFmultiple_int_reductions_same_typeEz"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
226ca4dbc27SSergio Afonso! CHECK:                 fir.store %[[VAL_19]] to %[[VAL_12]]#1 : !fir.ref<i32>
227be9f8ffdSDavid Truby! CHECK:                 %[[VAL_23:.*]] = fir.load %[[VAL_20]]#0 : !fir.ref<i32>
228be9f8ffdSDavid Truby! CHECK:                 %[[VAL_24:.*]] = fir.load %[[VAL_12]]#0 : !fir.ref<i32>
229be9f8ffdSDavid Truby! CHECK:                 %[[VAL_25:.*]] = arith.muli %[[VAL_23]], %[[VAL_24]] : i32
230be9f8ffdSDavid Truby! CHECK:                 hlfir.assign %[[VAL_25]] to %[[VAL_20]]#0 : i32, !fir.ref<i32>
231be9f8ffdSDavid Truby! CHECK:                 %[[VAL_26:.*]] = fir.load %[[VAL_21]]#0 : !fir.ref<i32>
232be9f8ffdSDavid Truby! CHECK:                 %[[VAL_27:.*]] = fir.load %[[VAL_12]]#0 : !fir.ref<i32>
233be9f8ffdSDavid Truby! CHECK:                 %[[VAL_28:.*]] = arith.muli %[[VAL_26]], %[[VAL_27]] : i32
234be9f8ffdSDavid Truby! CHECK:                 hlfir.assign %[[VAL_28]] to %[[VAL_21]]#0 : i32, !fir.ref<i32>
235be9f8ffdSDavid Truby! CHECK:                 %[[VAL_29:.*]] = fir.load %[[VAL_22]]#0 : !fir.ref<i32>
236be9f8ffdSDavid Truby! CHECK:                 %[[VAL_30:.*]] = fir.load %[[VAL_12]]#0 : !fir.ref<i32>
237be9f8ffdSDavid Truby! CHECK:                 %[[VAL_31:.*]] = arith.muli %[[VAL_29]], %[[VAL_30]] : i32
238be9f8ffdSDavid Truby! CHECK:                 hlfir.assign %[[VAL_31]] to %[[VAL_22]]#0 : i32, !fir.ref<i32>
2395b66987cSKiran Chandramohan! CHECK:                 omp.yield
2405b66987cSKiran Chandramohan! CHECK:             omp.terminator
2415b66987cSKiran Chandramohan! CHECK:           return
242be9f8ffdSDavid Truby
2435b66987cSKiran Chandramohansubroutine multiple_int_reductions_same_type
2445b66987cSKiran Chandramohan  integer :: x,y,z
2455b66987cSKiran Chandramohan  x = 1
2465b66987cSKiran Chandramohan  y = 1
2475b66987cSKiran Chandramohan  z = 1
2485b66987cSKiran Chandramohan  !$omp parallel
2495b66987cSKiran Chandramohan  !$omp do reduction(*:x,y,z)
2505b66987cSKiran Chandramohan  do i=1, 10
2515b66987cSKiran Chandramohan  x = x * i
2525b66987cSKiran Chandramohan  y = y * i
2535b66987cSKiran Chandramohan  z = z * i
2545b66987cSKiran Chandramohan  end do
2555b66987cSKiran Chandramohan  !$omp end do
2565b66987cSKiran Chandramohan  !$omp end parallel
2575b66987cSKiran Chandramohanend subroutine
2585b66987cSKiran Chandramohan
259be9f8ffdSDavid Truby! CHECK-LABEL:   func.func @_QPmultiple_real_reductions_same_type() {
260be9f8ffdSDavid Truby! CHECK:           %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFmultiple_real_reductions_same_typeEi"}
261be9f8ffdSDavid Truby! CHECK:           %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFmultiple_real_reductions_same_typeEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
262be9f8ffdSDavid Truby! CHECK:           %[[VAL_2:.*]] = fir.alloca f32 {bindc_name = "x", uniq_name = "_QFmultiple_real_reductions_same_typeEx"}
263be9f8ffdSDavid Truby! CHECK:           %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_2]] {uniq_name = "_QFmultiple_real_reductions_same_typeEx"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
264be9f8ffdSDavid Truby! CHECK:           %[[VAL_4:.*]] = fir.alloca f32 {bindc_name = "y", uniq_name = "_QFmultiple_real_reductions_same_typeEy"}
265be9f8ffdSDavid Truby! CHECK:           %[[VAL_5:.*]]:2 = hlfir.declare %[[VAL_4]] {uniq_name = "_QFmultiple_real_reductions_same_typeEy"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
266be9f8ffdSDavid Truby! CHECK:           %[[VAL_6:.*]] = fir.alloca f32 {bindc_name = "z", uniq_name = "_QFmultiple_real_reductions_same_typeEz"}
267be9f8ffdSDavid Truby! CHECK:           %[[VAL_7:.*]]:2 = hlfir.declare %[[VAL_6]] {uniq_name = "_QFmultiple_real_reductions_same_typeEz"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
268be9f8ffdSDavid Truby! CHECK:           %[[VAL_8:.*]] = arith.constant 1.000000e+00 : f32
269be9f8ffdSDavid Truby! CHECK:           hlfir.assign %[[VAL_8]] to %[[VAL_3]]#0 : f32, !fir.ref<f32>
270be9f8ffdSDavid Truby! CHECK:           %[[VAL_9:.*]] = arith.constant 1.000000e+00 : f32
271be9f8ffdSDavid Truby! CHECK:           hlfir.assign %[[VAL_9]] to %[[VAL_5]]#0 : f32, !fir.ref<f32>
272be9f8ffdSDavid Truby! CHECK:           %[[VAL_10:.*]] = arith.constant 1.000000e+00 : f32
273be9f8ffdSDavid Truby! CHECK:           hlfir.assign %[[VAL_10]] to %[[VAL_7]]#0 : f32, !fir.ref<f32>
274be9f8ffdSDavid Truby! CHECK:           omp.parallel {
275*937cbce1SKareem Ergawy! CHECK:             %[[VAL_11:.*]] = fir.alloca i32 {bindc_name = "i", pinned, {{.*}}}
276*937cbce1SKareem Ergawy! CHECK:             %[[VAL_12:.*]]:2 = hlfir.declare %[[VAL_11]] {uniq_name = "_QFmultiple_real_reductions_same_typeEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
277be9f8ffdSDavid Truby! CHECK:             %[[VAL_13:.*]] = arith.constant 1 : i32
278be9f8ffdSDavid Truby! CHECK:             %[[VAL_14:.*]] = arith.constant 10 : i32
279be9f8ffdSDavid Truby! CHECK:             %[[VAL_15:.*]] = arith.constant 1 : i32
280*937cbce1SKareem Ergawy! CHECK:             omp.wsloop reduction(@multiply_reduction_f32 %[[VAL_3]]#0 -> %[[VAL_16:.*]], @multiply_reduction_f32 %[[VAL_5]]#0 -> %[[VAL_17:.*]], @multiply_reduction_f32 %[[VAL_7]]#0 -> %[[VAL_18:.*]] : !fir.ref<f32>, !fir.ref<f32>, !fir.ref<f32>) {
281ca4dbc27SSergio Afonso! CHECK-NEXT:          omp.loop_nest (%[[VAL_19:.*]]) : i32 = (%[[VAL_13]]) to (%[[VAL_14]]) inclusive step (%[[VAL_15]]) {
282be9f8ffdSDavid Truby! CHECK:                 %[[VAL_20:.*]]:2 = hlfir.declare %[[VAL_16]] {uniq_name = "_QFmultiple_real_reductions_same_typeEx"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
283be9f8ffdSDavid Truby! CHECK:                 %[[VAL_21:.*]]:2 = hlfir.declare %[[VAL_17]] {uniq_name = "_QFmultiple_real_reductions_same_typeEy"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
284be9f8ffdSDavid Truby! CHECK:                 %[[VAL_22:.*]]:2 = hlfir.declare %[[VAL_18]] {uniq_name = "_QFmultiple_real_reductions_same_typeEz"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
285ca4dbc27SSergio Afonso! CHECK:                 fir.store %[[VAL_19]] to %[[VAL_12]]#1 : !fir.ref<i32>
286be9f8ffdSDavid Truby! CHECK:                 %[[VAL_23:.*]] = fir.load %[[VAL_20]]#0 : !fir.ref<f32>
287be9f8ffdSDavid Truby! CHECK:                 %[[VAL_24:.*]] = fir.load %[[VAL_12]]#0 : !fir.ref<i32>
288be9f8ffdSDavid Truby! CHECK:                 %[[VAL_25:.*]] = fir.convert %[[VAL_24]] : (i32) -> f32
289be9f8ffdSDavid Truby! CHECK:                 %[[VAL_26:.*]] = arith.mulf %[[VAL_23]], %[[VAL_25]] fastmath<contract> : f32
290be9f8ffdSDavid Truby! CHECK:                 hlfir.assign %[[VAL_26]] to %[[VAL_20]]#0 : f32, !fir.ref<f32>
291be9f8ffdSDavid Truby! CHECK:                 %[[VAL_27:.*]] = fir.load %[[VAL_21]]#0 : !fir.ref<f32>
292be9f8ffdSDavid Truby! CHECK:                 %[[VAL_28:.*]] = fir.load %[[VAL_12]]#0 : !fir.ref<i32>
293be9f8ffdSDavid Truby! CHECK:                 %[[VAL_29:.*]] = fir.convert %[[VAL_28]] : (i32) -> f32
294be9f8ffdSDavid Truby! CHECK:                 %[[VAL_30:.*]] = arith.mulf %[[VAL_27]], %[[VAL_29]] fastmath<contract> : f32
295be9f8ffdSDavid Truby! CHECK:                 hlfir.assign %[[VAL_30]] to %[[VAL_21]]#0 : f32, !fir.ref<f32>
296be9f8ffdSDavid Truby! CHECK:                 %[[VAL_31:.*]] = fir.load %[[VAL_22]]#0 : !fir.ref<f32>
297be9f8ffdSDavid Truby! CHECK:                 %[[VAL_32:.*]] = fir.load %[[VAL_12]]#0 : !fir.ref<i32>
298be9f8ffdSDavid Truby! CHECK:                 %[[VAL_33:.*]] = fir.convert %[[VAL_32]] : (i32) -> f32
299be9f8ffdSDavid Truby! CHECK:                 %[[VAL_34:.*]] = arith.mulf %[[VAL_31]], %[[VAL_33]] fastmath<contract> : f32
300be9f8ffdSDavid Truby! CHECK:                 hlfir.assign %[[VAL_34]] to %[[VAL_22]]#0 : f32, !fir.ref<f32>
3015b66987cSKiran Chandramohan! CHECK:                 omp.yield
3025b66987cSKiran Chandramohan! CHECK:             omp.terminator
3035b66987cSKiran Chandramohan! CHECK:           return
304be9f8ffdSDavid Truby
3055b66987cSKiran Chandramohansubroutine multiple_real_reductions_same_type
3065b66987cSKiran Chandramohan  real :: x,y,z
3075b66987cSKiran Chandramohan  x = 1
3085b66987cSKiran Chandramohan  y = 1
3095b66987cSKiran Chandramohan  z = 1
3105b66987cSKiran Chandramohan  !$omp parallel
3115b66987cSKiran Chandramohan  !$omp do reduction(*:x,y,z)
3125b66987cSKiran Chandramohan  do i=1, 10
3135b66987cSKiran Chandramohan    x = x * i
3145b66987cSKiran Chandramohan    y = y * i
3155b66987cSKiran Chandramohan    z = z * i
3165b66987cSKiran Chandramohan  end do
3175b66987cSKiran Chandramohan  !$omp end do
3185b66987cSKiran Chandramohan  !$omp end parallel
3195b66987cSKiran Chandramohanend subroutine
3205b66987cSKiran Chandramohan
321be9f8ffdSDavid Truby! CHECK-LABEL:   func.func @_QPmultiple_reductions_different_type() {
322be9f8ffdSDavid Truby! CHECK:           %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFmultiple_reductions_different_typeEi"}
323be9f8ffdSDavid Truby! CHECK:           %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QFmultiple_reductions_different_typeEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
324be9f8ffdSDavid Truby! CHECK:           %[[VAL_2:.*]] = fir.alloca f64 {bindc_name = "w", uniq_name = "_QFmultiple_reductions_different_typeEw"}
325be9f8ffdSDavid Truby! CHECK:           %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_2]] {uniq_name = "_QFmultiple_reductions_different_typeEw"} : (!fir.ref<f64>) -> (!fir.ref<f64>, !fir.ref<f64>)
326be9f8ffdSDavid Truby! CHECK:           %[[VAL_4:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFmultiple_reductions_different_typeEx"}
327be9f8ffdSDavid Truby! CHECK:           %[[VAL_5:.*]]:2 = hlfir.declare %[[VAL_4]] {uniq_name = "_QFmultiple_reductions_different_typeEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
328be9f8ffdSDavid Truby! CHECK:           %[[VAL_6:.*]] = fir.alloca i64 {bindc_name = "y", uniq_name = "_QFmultiple_reductions_different_typeEy"}
329be9f8ffdSDavid Truby! CHECK:           %[[VAL_7:.*]]:2 = hlfir.declare %[[VAL_6]] {uniq_name = "_QFmultiple_reductions_different_typeEy"} : (!fir.ref<i64>) -> (!fir.ref<i64>, !fir.ref<i64>)
330be9f8ffdSDavid Truby! CHECK:           %[[VAL_8:.*]] = fir.alloca f32 {bindc_name = "z", uniq_name = "_QFmultiple_reductions_different_typeEz"}
331be9f8ffdSDavid Truby! CHECK:           %[[VAL_9:.*]]:2 = hlfir.declare %[[VAL_8]] {uniq_name = "_QFmultiple_reductions_different_typeEz"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
332be9f8ffdSDavid Truby! CHECK:           %[[VAL_10:.*]] = arith.constant 1 : i32
333be9f8ffdSDavid Truby! CHECK:           hlfir.assign %[[VAL_10]] to %[[VAL_5]]#0 : i32, !fir.ref<i32>
334be9f8ffdSDavid Truby! CHECK:           %[[VAL_11:.*]] = arith.constant 1 : i64
335be9f8ffdSDavid Truby! CHECK:           hlfir.assign %[[VAL_11]] to %[[VAL_7]]#0 : i64, !fir.ref<i64>
336be9f8ffdSDavid Truby! CHECK:           %[[VAL_12:.*]] = arith.constant 1.000000e+00 : f32
337be9f8ffdSDavid Truby! CHECK:           hlfir.assign %[[VAL_12]] to %[[VAL_9]]#0 : f32, !fir.ref<f32>
338be9f8ffdSDavid Truby! CHECK:           %[[VAL_13:.*]] = arith.constant 1.000000e+00 : f64
339be9f8ffdSDavid Truby! CHECK:           hlfir.assign %[[VAL_13]] to %[[VAL_3]]#0 : f64, !fir.ref<f64>
340be9f8ffdSDavid Truby! CHECK:           omp.parallel {
341*937cbce1SKareem Ergawy! CHECK:             %[[VAL_14:.*]] = fir.alloca i32 {bindc_name = "i", pinned, {{.*}}}
342*937cbce1SKareem Ergawy! CHECK:             %[[VAL_15:.*]]:2 = hlfir.declare %[[VAL_14]] {uniq_name = "_QFmultiple_reductions_different_typeEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
343be9f8ffdSDavid Truby! CHECK:             %[[VAL_16:.*]] = arith.constant 1 : i32
344be9f8ffdSDavid Truby! CHECK:             %[[VAL_17:.*]] = arith.constant 10 : i32
345be9f8ffdSDavid Truby! CHECK:             %[[VAL_18:.*]] = arith.constant 1 : i32
346*937cbce1SKareem Ergawy! CHECK:             omp.wsloop reduction(@multiply_reduction_i32 %[[VAL_5]]#0 -> %[[VAL_19:.*]], @multiply_reduction_i64 %[[VAL_7]]#0 -> %[[VAL_20:.*]], @multiply_reduction_f32 %[[VAL_9]]#0 -> %[[VAL_21:.*]], @multiply_reduction_f64 %[[VAL_3]]#0 -> %[[VAL_22:.*]] : !fir.ref<i32>, !fir.ref<i64>, !fir.ref<f32>, !fir.ref<f64>) {
347ca4dbc27SSergio Afonso! CHECK-NEXT:          omp.loop_nest (%[[VAL_23:.*]]) : i32 = (%[[VAL_16]]) to (%[[VAL_17]]) inclusive step (%[[VAL_18]]) {
348be9f8ffdSDavid Truby! CHECK:                 %[[VAL_24:.*]]:2 = hlfir.declare %[[VAL_19]] {uniq_name = "_QFmultiple_reductions_different_typeEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
349be9f8ffdSDavid Truby! CHECK:                 %[[VAL_25:.*]]:2 = hlfir.declare %[[VAL_20]] {uniq_name = "_QFmultiple_reductions_different_typeEy"} : (!fir.ref<i64>) -> (!fir.ref<i64>, !fir.ref<i64>)
350be9f8ffdSDavid Truby! CHECK:                 %[[VAL_26:.*]]:2 = hlfir.declare %[[VAL_21]] {uniq_name = "_QFmultiple_reductions_different_typeEz"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
351be9f8ffdSDavid Truby! CHECK:                 %[[VAL_27:.*]]:2 = hlfir.declare %[[VAL_22]] {uniq_name = "_QFmultiple_reductions_different_typeEw"} : (!fir.ref<f64>) -> (!fir.ref<f64>, !fir.ref<f64>)
352ca4dbc27SSergio Afonso! CHECK:                 fir.store %[[VAL_23]] to %[[VAL_15]]#1 : !fir.ref<i32>
353be9f8ffdSDavid Truby! CHECK:                 %[[VAL_28:.*]] = fir.load %[[VAL_24]]#0 : !fir.ref<i32>
354be9f8ffdSDavid Truby! CHECK:                 %[[VAL_29:.*]] = fir.load %[[VAL_15]]#0 : !fir.ref<i32>
355be9f8ffdSDavid Truby! CHECK:                 %[[VAL_30:.*]] = arith.muli %[[VAL_28]], %[[VAL_29]] : i32
356be9f8ffdSDavid Truby! CHECK:                 hlfir.assign %[[VAL_30]] to %[[VAL_24]]#0 : i32, !fir.ref<i32>
357be9f8ffdSDavid Truby! CHECK:                 %[[VAL_31:.*]] = fir.load %[[VAL_25]]#0 : !fir.ref<i64>
358be9f8ffdSDavid Truby! CHECK:                 %[[VAL_32:.*]] = fir.load %[[VAL_15]]#0 : !fir.ref<i32>
359be9f8ffdSDavid Truby! CHECK:                 %[[VAL_33:.*]] = fir.convert %[[VAL_32]] : (i32) -> i64
360be9f8ffdSDavid Truby! CHECK:                 %[[VAL_34:.*]] = arith.muli %[[VAL_31]], %[[VAL_33]] : i64
361be9f8ffdSDavid Truby! CHECK:                 hlfir.assign %[[VAL_34]] to %[[VAL_25]]#0 : i64, !fir.ref<i64>
362be9f8ffdSDavid Truby! CHECK:                 %[[VAL_35:.*]] = fir.load %[[VAL_26]]#0 : !fir.ref<f32>
363be9f8ffdSDavid Truby! CHECK:                 %[[VAL_36:.*]] = fir.load %[[VAL_15]]#0 : !fir.ref<i32>
364be9f8ffdSDavid Truby! CHECK:                 %[[VAL_37:.*]] = fir.convert %[[VAL_36]] : (i32) -> f32
365be9f8ffdSDavid Truby! CHECK:                 %[[VAL_38:.*]] = arith.mulf %[[VAL_35]], %[[VAL_37]] fastmath<contract> : f32
366be9f8ffdSDavid Truby! CHECK:                 hlfir.assign %[[VAL_38]] to %[[VAL_26]]#0 : f32, !fir.ref<f32>
367be9f8ffdSDavid Truby! CHECK:                 %[[VAL_39:.*]] = fir.load %[[VAL_27]]#0 : !fir.ref<f64>
368be9f8ffdSDavid Truby! CHECK:                 %[[VAL_40:.*]] = fir.load %[[VAL_15]]#0 : !fir.ref<i32>
369be9f8ffdSDavid Truby! CHECK:                 %[[VAL_41:.*]] = fir.convert %[[VAL_40]] : (i32) -> f64
370be9f8ffdSDavid Truby! CHECK:                 %[[VAL_42:.*]] = arith.mulf %[[VAL_39]], %[[VAL_41]] fastmath<contract> : f64
371be9f8ffdSDavid Truby! CHECK:                 hlfir.assign %[[VAL_42]] to %[[VAL_27]]#0 : f64, !fir.ref<f64>
372be9f8ffdSDavid Truby! CHECK:                 omp.yield
3735b66987cSKiran Chandramohan! CHECK:             omp.terminator
3745b66987cSKiran Chandramohan! CHECK:           return
375be9f8ffdSDavid Truby
376be9f8ffdSDavid Truby
3775b66987cSKiran Chandramohansubroutine multiple_reductions_different_type
3785b66987cSKiran Chandramohan  integer :: x
3795b66987cSKiran Chandramohan  integer(kind=8) :: y
3805b66987cSKiran Chandramohan  real :: z
3815b66987cSKiran Chandramohan  real(kind=8) :: w
3825b66987cSKiran Chandramohan  x = 1
3835b66987cSKiran Chandramohan  y = 1
3845b66987cSKiran Chandramohan  z = 1
3855b66987cSKiran Chandramohan  w = 1
3865b66987cSKiran Chandramohan  !$omp parallel
3875b66987cSKiran Chandramohan  !$omp do reduction(*:x,y,z,w)
3885b66987cSKiran Chandramohan  do i=1, 10
3895b66987cSKiran Chandramohan    x = x * i
3905b66987cSKiran Chandramohan    y = y * i
3915b66987cSKiran Chandramohan    z = z * i
3925b66987cSKiran Chandramohan    w = w * i
3935b66987cSKiran Chandramohan  end do
3945b66987cSKiran Chandramohan  !$omp end do
3955b66987cSKiran Chandramohan  !$omp end parallel
3965b66987cSKiran Chandramohanend subroutine
397