brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · 795e417 Raw
58 lines · plain
1! RUN: bbc -emit-hlfir -fopenmp --force-byref-reduction %s -o - | FileCheck %s2! RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --force-byref-reduction %s -o - | FileCheck %s3 4! CHECK-LABEL:   omp.declare_reduction @ieor_byref_i32 : !fir.ref<i32>5! CHECK-SAME:    alloc {6! CHECK:            %[[REF:.*]] = fir.alloca i327! CHECK:            omp.yield(%[[REF]] : !fir.ref<i32>)8! CHECK-LABEL:   } init {9! CHECK:         ^bb0(%[[VAL_0:.*]]: !fir.ref<i32>, %[[ALLOC:.*]]: !fir.ref<i32>):10! CHECK:            %[[C0_1:.*]] = arith.constant 0 : i3211! CHECK:            fir.store %[[C0_1]] to %[[ALLOC]] : !fir.ref<i32>12! CHECK:            omp.yield(%[[ALLOC]] : !fir.ref<i32>)13 14! CHECK-LABEL:   } combiner {15! CHECK:         ^bb0(%[[ARG0:.*]]: !fir.ref<i32>, %[[ARG1:.*]]: !fir.ref<i32>):16! CHECK:           %[[LD0:.*]] = fir.load %[[ARG0]] : !fir.ref<i32>17! CHECK:           %[[LD1:.*]] = fir.load %[[ARG1]] : !fir.ref<i32>18! CHECK:           %[[RES:.*]] = arith.xori %[[LD0]], %[[LD1]] : i3219! CHECK:           fir.store %[[RES]] to %[[ARG0]] : !fir.ref<i32>20! CHECK:           omp.yield(%[[ARG0]] : !fir.ref<i32>)21! CHECK:         }22 23!CHECK-LABEL: @_QPreduction_ieor24!CHECK-SAME: %[[Y_BOX:.*]]: !fir.box<!fir.array<?xi32>>25!CHECK: %[[X_REF:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFreduction_ieorEx"}26!CHECK: %[[X_DECL:.*]]:2 = hlfir.declare %[[X_REF]] {uniq_name = "_QFreduction_ieorEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)27!CHECK: %[[Y_DECL:.*]]:2 = hlfir.declare %[[Y_BOX]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {uniq_name = "_QFreduction_ieorEy"} : (!fir.box<!fir.array<?xi32>>, !fir.dscope) -> (!fir.box<!fir.array<?xi32>>, !fir.box<!fir.array<?xi32>>)28 29 30!CHECK: omp.parallel31!CHECK: omp.wsloop private(@{{.*}} %{{.*}}#0 -> %[[I_REF:.*]] : !fir.ref<i32>) reduction(byref @ieor_byref_i32 %[[X_DECL]]#0 -> %[[PRV:.+]] : !fir.ref<i32>)32!CHECK-NEXT: omp.loop_nest33!CHECK: %[[I_DECL:.*]]:2 = hlfir.declare %[[I_REF]] {uniq_name = "_QFreduction_ieorEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)34!CHECK: %[[PRV_DECL:.+]]:2 = hlfir.declare %[[PRV]] {{.*}} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)35!CHECK: hlfir.assign %{{.*}} to %[[I_DECL]]#0 : i32, !fir.ref<i32>36!CHECK: %[[I_32:.*]] = fir.load %[[I_DECL]]#0 : !fir.ref<i32>37!CHECK: %[[I_64:.*]] = fir.convert %[[I_32]] : (i32) -> i6438!CHECK: %[[Y_I_REF:.*]] = hlfir.designate %[[Y_DECL]]#0 (%[[I_64]])  : (!fir.box<!fir.array<?xi32>>, i64) -> !fir.ref<i32>39!CHECK: %[[LPRV:.+]] = fir.load %[[PRV_DECL]]#0 : !fir.ref<i32>40!CHECK: %[[Y_I:.*]] = fir.load %[[Y_I_REF]] : !fir.ref<i32>41!CHECK: %[[RES:.+]] = arith.xori %[[LPRV]], %[[Y_I]] : i3242!CHECK: hlfir.assign %[[RES]] to %[[PRV_DECL]]#0 : i32, !fir.ref<i32>43!CHECK: omp.yield44!CHECK: omp.terminator45 46subroutine reduction_ieor(y)47  integer :: x, y(:)48  x = 049  !$omp parallel50  !$omp do reduction(ieor:x)51  do i=1, 10052    x = ieor(x, y(i))53  end do54  !$omp end do55  !$omp end parallel56  print *, x57end subroutine58