52 lines · plain
1! This test checks lowering of num_tasks clause in taskloop directive.2 3! RUN: bbc -emit-hlfir -fopenmp -fopenmp-version=50 -o - %s 2>&1 | FileCheck %s4! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 -o - %s 2>&1 | FileCheck %s5 6! CHECK-LABEL: omp.private7! CHECK-SAME: {type = private} @[[I_PRIVATE_TEST2:.*]] : i328 9! CHECK-LABEL: omp.private10! CHECK-SAME: {type = firstprivate} @[[X_FIRSTPRIVATE_TEST2:.*]] : i3211! CHECK-SAME: copy {12! CHECK: hlfir.assign13 14! CHECK-LABEL: omp.private15! CHECK-SAME: {type = private} @[[I_PRIVATE:.*]] : i3216 17! CHECK-LABEL: omp.private18! CHECK-SAME: {type = firstprivate} @[[X_FIRSTPRIVATE:.*]] : i3219! CHECK-SAME: copy {20! CHECK: hlfir.assign21 22! CHECK-LABEL: func.func @_QPtest_num_tasks23! CHECK: %[[ALLOCA_I:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFtest_num_tasksEi"}24! CHECK: %[[DECL_I:.*]]:2 = hlfir.declare %[[ALLOCA_I]] {uniq_name = "_QFtest_num_tasksEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)25! CHECK: %[[ALLOCA_X:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFtest_num_tasksEx"}26! CHECK: %[[DECL_X:.*]]:2 = hlfir.declare %[[ALLOCA_X]] {uniq_name = "_QFtest_num_tasksEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)27! CHECK: %[[VAL_NUMTASKS:.*]] = arith.constant 10 : i3228subroutine test_num_tasks29 integer :: i, x30 ! CHECK: omp.taskloop num_tasks(%[[VAL_NUMTASKS]]: i32) 31 ! CHECK-SAME: private(@[[X_FIRSTPRIVATE]] %[[DECL_X]]#0 -> %[[ARG0:.*]], @[[I_PRIVATE]] %[[DECL_I]]#0 -> %[[ARG1:.*]] : !fir.ref<i32>, !fir.ref<i32>) {32 ! CHECK: omp.loop_nest (%[[ARG2:.*]]) : i32 = (%{{.*}}) to (%{{.*}}) inclusive step (%{{.*}}) {33 !$omp taskloop num_tasks(10)34 do i = 1, 100035 x = x + 136 end do37 !$omp end taskloop38end subroutine test_num_tasks39 40! CHECK-LABEL: func.func @_QPtest_num_tasks_strict41subroutine test_num_tasks_strict42 integer :: x, i43 ! CHECK: %[[NUM_TASKS:.*]] = arith.constant 10 : i3244 ! CHECK: omp.taskloop num_tasks(strict, %[[NUM_TASKS]]: i32)45 !$omp taskloop num_tasks(strict:10)46 do i = 1, 10047 !CHECK: arith.addi48 x = x + 149 end do50 !$omp end taskloop51end subroutine52