[AMDGPU] Test codegen'ing True16 additions.
[llvm-project.git] / flang / test / Lower / OpenMP / wsloop-reduction-max-hlfir.f90
blob0c5d99226600bfd4d0506e193d0b54b4808ab0be
1 ! RUN: bbc -emit-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s
2 ! RUN: %flang_fc1 -emit-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s
4 !CHECK: omp.reduction.declare @[[MAX_DECLARE_I:.*]] : i32 init {
5 !CHECK: %[[MINIMUM_VAL_I:.*]] = arith.constant -2147483648 : i32
6 !CHECK: omp.yield(%[[MINIMUM_VAL_I]] : i32)
7 !CHECK: combiner
8 !CHECK: ^bb0(%[[ARG0_I:.*]]: i32, %[[ARG1_I:.*]]: i32):
9 !CHECK: %[[COMB_VAL_I:.*]] = arith.maxsi %[[ARG0_I]], %[[ARG1_I]] : i32
10 !CHECK: omp.yield(%[[COMB_VAL_I]] : i32)
12 !CHECK-LABEL: @_QPreduction_max_int
13 !CHECK-SAME: %[[Y_BOX:.*]]: !fir.box<!fir.array<?xi32>>
14 !CHECK: %[[X_REF:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFreduction_max_intEx"}
15 !CHECK: %[[X_DECL:.*]]:2 = hlfir.declare %[[X_REF]] {uniq_name = "_QFreduction_max_intEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
16 !CHECK: %[[Y_DECL:.*]]:2 = hlfir.declare %[[Y_BOX]] {uniq_name = "_QFreduction_max_intEy"} : (!fir.box<!fir.array<?xi32>>) -> (!fir.box<!fir.array<?xi32>>, !fir.box<!fir.array<?xi32>>)
17 !CHECK: omp.parallel
18 !CHECK: omp.wsloop reduction(@[[MAX_DECLARE_I]] -> %[[X_DECL]]#0 : !fir.ref<i32>) for
19 !CHECK: %[[Y_I_REF:.*]] = hlfir.designate %[[Y_DECL]]#0 ({{.*}}) : (!fir.box<!fir.array<?xi32>>, i64) -> !fir.ref<i32>
20 !CHECK: %[[Y_I:.*]] = fir.load %[[Y_I_REF]] : !fir.ref<i32>
21 !CHECK: omp.reduction %[[Y_I]], %[[X_DECL]]#0 : i32, !fir.ref<i32>
22 !CHECK: omp.yield
23 !CHECK: omp.terminator
25 subroutine reduction_max_int(y)
26 integer :: x, y(:)
27 x = 0
28 !$omp parallel
29 !$omp do reduction(max:x)
30 do i=1, 100
31 x = max(x, y(i))
32 end do
33 !$omp end do
34 !$omp end parallel
35 print *, x
36 end subroutine