69 lines · plain
1! Tests that if `do concurrent` is not perfectly nested in its parent loop, that2! we skip converting the not-perfectly nested `do concurrent` loop.3 4 5! RUN: %flang_fc1 -emit-hlfir -fopenmp -fdo-concurrent-to-openmp=host %s -o - \6! RUN: | FileCheck %s --check-prefixes=COMMON7 8! RUN: %flang_fc1 -emit-hlfir -fopenmp -fdo-concurrent-to-openmp=device %s -o - \9! RUN: | FileCheck %s --check-prefixes=DEVICE,COMMON10 11program main12 integer, parameter :: n = 1013 integer, parameter :: m = 2014 integer, parameter :: l = 3015 integer x;16 integer :: a(n, m, l)17 18 do concurrent(i=1:n)19 x = 1020 do concurrent(j=1:m, k=1:l)21 a(i,j,k) = i * j + k22 end do23 end do24end25 26 27 28! DEVICE: omp.target {{.*}}map_entries(29! DEVICE-SAME: %{{[[:alnum:]]+}} -> %{{[^,]+}},30! DEVICE-SAME: %{{[[:alnum:]]+}} -> %{{[^,]+}},31! DEVICE-SAME: %{{[[:alnum:]]+}} -> %{{[^,]+}},32! DEVICE-SAME: %{{[^[:space:]]+}} -> %[[I_ARG:[^,]+]],33! DEVICE-SAME: %{{[^[:space:]]+}} -> %[[X_ARG:[^,]+]],34! DEVICE-SAME: %{{[^[:space:]]+}} -> %[[A_ARG:[^,]+]],35! DEVICE-SAME: %{{[^[:space:]]+}} -> %{{[^,]+}},36! DEVICE-SAME: %{{[^[:space:]]+}} -> %{{[^,]+}},37! DEVICE-SAME: %{{[^[:space:]]+}} -> %{{[^:]+}} :38! DEVICE-SAME: {{.*}}) {39 40! DEVICE: omp.teams41 42! COMMON: omp.parallel {43 44! DEVICE: omp.distribute45 46! COMMON: omp.wsloop {47! COMMON: omp.loop_nest ({{[^[:space:]]+}}) {{.*}} {48! COMMON: fir.do_concurrent {49 50! COMMON: %[[ORIG_J_ALLOC:.*]] = fir.alloca i32 {bindc_name = "j"}51! COMMON: %[[ORIG_J_DECL:.*]]:2 = hlfir.declare %[[ORIG_J_ALLOC]]52 53! COMMON: %[[ORIG_K_ALLOC:.*]] = fir.alloca i32 {bindc_name = "k"}54! COMMON: %[[ORIG_K_DECL:.*]]:2 = hlfir.declare %[[ORIG_K_ALLOC]]55 56! COMMON: fir.do_concurrent.loop (%[[J_IV:.*]], %[[K_IV:.*]]) = {{.*}} {57! COMMON: %[[J_IV_CONV:.*]] = fir.convert %[[J_IV]] : (index) -> i3258! COMMON: fir.store %[[J_IV_CONV]] to %[[ORIG_J_DECL]]#059 60! COMMON: %[[K_IV_CONV:.*]] = fir.convert %[[K_IV]] : (index) -> i3261! COMMON: fir.store %[[K_IV_CONV]] to %[[ORIG_K_DECL]]#062! COMMON: }63! COMMON: }64! COMMON: omp.yield65! COMMON: }66! COMMON: }67! COMMON: omp.terminator68! COMMON: }69