brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · ea57d35 Raw
115 lines · plain
1! REQUIRES: openmp_runtime2 3! RUN: %flang_fc1 -emit-hlfir %openmp_flags %s -o - | FileCheck %s4 5! CHECK-LABEL: func @_QPdistribute_simple6subroutine distribute_simple()7  ! CHECK: omp.teams8  !$omp teams9 10  ! CHECK: omp.distribute private({{.*}}) {11  !$omp distribute12 13  ! CHECK-NEXT: omp.loop_nest14  do i = 1, 1015    call foo()16    ! CHECK: omp.yield17  end do18 19  !$omp end distribute20 21  ! CHECK: omp.terminator22  !$omp end teams23end subroutine distribute_simple24 25!===============================================================================26! `dist_schedule` clause27!===============================================================================28 29! CHECK-LABEL: func @_QPdistribute_dist_schedule30! CHECK-SAME: %[[X_ARG:.*]]: !fir.ref<i32>31subroutine distribute_dist_schedule(x)32  ! CHECK: %[[X_REF:.*]]:2 = hlfir.declare %[[X_ARG]]33  integer, intent(in) :: x34 35  ! CHECK: omp.teams36  !$omp teams37 38  ! STATIC SCHEDULE, CONSTANT CHUNK SIZE39 40  ! CHECK: %[[CONST_CHUNK_SIZE:.*]] = arith.constant 5 : i3241  ! CHECK: omp.distribute42  ! CHECK-SAME: dist_schedule_static43  ! CHECK-SAME: chunk_size(%[[CONST_CHUNK_SIZE]] : i32)44  !$omp distribute dist_schedule(static, 5)45 46  ! CHECK-NEXT: omp.loop_nest47  do i = 1, 1048    call foo()49    ! CHECK: omp.yield50  end do51 52  !$omp end distribute53 54  ! STATIC SCHEDULE, VARIABLE CHUNK SIZE55 56  ! CHECK: %[[X:.*]] = fir.load %[[X_REF]]#057  ! CHECK: omp.distribute58  ! CHECK-SAME: dist_schedule_static59  ! CHECK-SAME: chunk_size(%[[X]] : i32)60  !$omp distribute dist_schedule(static, x)61 62  ! CHECK-NEXT: omp.loop_nest63  do i = 1, 1064    call foo()65    ! CHECK: omp.yield66  end do67 68  !$omp end distribute69 70  ! STATIC SCHEDULE, NO CHUNK SIZE71 72  ! CHECK: omp.distribute73  ! CHECK-SAME: dist_schedule_static74  ! CHECK-NOT: chunk_size75  !$omp distribute dist_schedule(static)76 77  ! CHECK-NEXT: omp.loop_nest78  do i = 1, 1079    call foo()80    ! CHECK: omp.yield81  end do82 83  !$omp end distribute84 85  ! CHECK: omp.terminator86  !$omp end teams87end subroutine distribute_dist_schedule88 89!===============================================================================90! `allocate` clause91!===============================================================================92 93! CHECK-LABEL: func @_QPdistribute_allocate94subroutine distribute_allocate()95  use omp_lib96  integer :: x97  ! CHECK: omp.teams98  !$omp teams99 100  ! CHECK: omp.distribute101  ! CHECK-SAME: allocate(%{{.+}} : i64 -> %{{.+}} : !fir.ref<i32>)102  !$omp distribute allocate(omp_high_bw_mem_alloc: x) private(x)103 104  ! CHECK-NEXT: omp.loop_nest105  do i = 1, 10106    x = i107    ! CHECK: omp.yield 108  end do109 110  !$omp end distribute111 112  ! CHECK: omp.terminator113  !$omp end teams114end subroutine distribute_allocate115