brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.9 KiB · 4abf750 Raw
186 lines · plain
1!RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=52 %s -o - | FileCheck %s --check-prefixes ALL,HOST2!RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=52 -fopenmp-is-device %s -o - | FileCheck %s --check-prefixes ALL,DEVICE3 4! Check specification valid forms of declare target with functions 5! utilising device_type and to clauses as well as the default 6! zero clause declare target7 8! DEVICE-LABEL: func.func @_QPfunc_t_device()9! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), automap = false>{{.*}}10FUNCTION FUNC_T_DEVICE() RESULT(I)11!$omp declare target to(FUNC_T_DEVICE) device_type(nohost)12    INTEGER :: I13    I = 114END FUNCTION FUNC_T_DEVICE15 16! DEVICE-LABEL: func.func @_QPfunc_enter_device()17! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter), automap = false>{{.*}}18FUNCTION FUNC_ENTER_DEVICE() RESULT(I)19!$omp declare target enter(FUNC_ENTER_DEVICE) device_type(nohost)20    INTEGER :: I21    I = 122END FUNCTION FUNC_ENTER_DEVICE23 24! HOST-LABEL: func.func @_QPfunc_t_host()25! HOST-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to), automap = false>{{.*}}26FUNCTION FUNC_T_HOST() RESULT(I)27!$omp declare target to(FUNC_T_HOST) device_type(host)28    INTEGER :: I29    I = 130END FUNCTION FUNC_T_HOST31 32! HOST-LABEL: func.func @_QPfunc_enter_host()33! HOST-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (enter), automap = false>{{.*}}34FUNCTION FUNC_ENTER_HOST() RESULT(I)35!$omp declare target enter(FUNC_ENTER_HOST) device_type(host)36    INTEGER :: I37    I = 138END FUNCTION FUNC_ENTER_HOST39 40! ALL-LABEL: func.func @_QPfunc_t_any()41! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), automap = false>{{.*}}42FUNCTION FUNC_T_ANY() RESULT(I)43!$omp declare target to(FUNC_T_ANY) device_type(any)44    INTEGER :: I45    I = 146END FUNCTION FUNC_T_ANY47 48! ALL-LABEL: func.func @_QPfunc_enter_any()49! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter), automap = false>{{.*}}50FUNCTION FUNC_ENTER_ANY() RESULT(I)51!$omp declare target enter(FUNC_ENTER_ANY) device_type(any)52    INTEGER :: I53    I = 154END FUNCTION FUNC_ENTER_ANY55 56! ALL-LABEL: func.func @_QPfunc_default_t_any()57! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), automap = false>{{.*}}58FUNCTION FUNC_DEFAULT_T_ANY() RESULT(I)59!$omp declare target to(FUNC_DEFAULT_T_ANY)60    INTEGER :: I61    I = 162END FUNCTION FUNC_DEFAULT_T_ANY63 64! ALL-LABEL: func.func @_QPfunc_default_enter_any()65! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter), automap = false>{{.*}}66FUNCTION FUNC_DEFAULT_ENTER_ANY() RESULT(I)67!$omp declare target enter(FUNC_DEFAULT_ENTER_ANY)68    INTEGER :: I69    I = 170END FUNCTION FUNC_DEFAULT_ENTER_ANY71 72! ALL-LABEL: func.func @_QPfunc_default_any()73! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), automap = false>{{.*}}74FUNCTION FUNC_DEFAULT_ANY() RESULT(I)75!$omp declare target76    INTEGER :: I77    I = 178END FUNCTION FUNC_DEFAULT_ANY79 80! ALL-LABEL: func.func @_QPfunc_default_extendedlist()81! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), automap = false>{{.*}}82FUNCTION FUNC_DEFAULT_EXTENDEDLIST() RESULT(I)83!$omp declare target(FUNC_DEFAULT_EXTENDEDLIST)84    INTEGER :: I85    I = 186END FUNCTION FUNC_DEFAULT_EXTENDEDLIST87 88! ALL-LABEL: func.func @_QPfunc_name_as_result()89! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), automap = false>{{.*}}90FUNCTION FUNC_NAME_AS_RESULT()91!$omp declare target(FUNC_NAME_AS_RESULT)92  FUNC_NAME_AS_RESULT = 1.093END FUNCTION FUNC_NAME_AS_RESULT94 95!! -----96 97! Check specification valid forms of declare target with subroutines 98! utilising device_type and to clauses as well as the default 99! zero clause declare target100 101! DEVICE-LABEL: func.func @_QPsubr_t_device()102! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), automap = false>{{.*}}103SUBROUTINE SUBR_T_DEVICE()104!$omp declare target to(SUBR_T_DEVICE) device_type(nohost)105END106 107! DEVICE-LABEL: func.func @_QPsubr_enter_device()108! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter), automap = false>{{.*}}109SUBROUTINE SUBR_ENTER_DEVICE()110!$omp declare target enter(SUBR_ENTER_DEVICE) device_type(nohost)111END112 113! HOST-LABEL: func.func @_QPsubr_t_host()114! HOST-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to), automap = false>{{.*}}115SUBROUTINE SUBR_T_HOST()116!$omp declare target to(SUBR_T_HOST) device_type(host)117END118 119! HOST-LABEL: func.func @_QPsubr_enter_host()120! HOST-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (enter), automap = false>{{.*}}121SUBROUTINE SUBR_ENTER_HOST()122!$omp declare target enter(SUBR_ENTER_HOST) device_type(host)123END124 125! ALL-LABEL: func.func @_QPsubr_t_any()126! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), automap = false>{{.*}}127SUBROUTINE SUBR_T_ANY()128!$omp declare target to(SUBR_T_ANY) device_type(any)129END130 131! ALL-LABEL: func.func @_QPsubr_enter_any()132! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter), automap = false>{{.*}}133SUBROUTINE SUBR_ENTER_ANY()134!$omp declare target enter(SUBR_ENTER_ANY) device_type(any)135END136 137! ALL-LABEL: func.func @_QPsubr_default_t_any()138! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), automap = false>{{.*}}139SUBROUTINE SUBR_DEFAULT_T_ANY()140!$omp declare target to(SUBR_DEFAULT_T_ANY)141END142 143! ALL-LABEL: func.func @_QPsubr_default_enter_any()144! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (enter), automap = false>{{.*}}145SUBROUTINE SUBR_DEFAULT_ENTER_ANY()146!$omp declare target enter(SUBR_DEFAULT_ENTER_ANY)147END148 149! ALL-LABEL: func.func @_QPsubr_default_any()150! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), automap = false>{{.*}}151SUBROUTINE SUBR_DEFAULT_ANY()152!$omp declare target153END154 155! ALL-LABEL: func.func @_QPsubr_default_extendedlist()156! ALL-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to), automap = false>{{.*}}157SUBROUTINE SUBR_DEFAULT_EXTENDEDLIST()158!$omp declare target(SUBR_DEFAULT_EXTENDEDLIST)159END160 161!! -----162 163! DEVICE-LABEL: func.func @_QPrecursive_declare_target164! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (to), automap = false>{{.*}}165RECURSIVE FUNCTION RECURSIVE_DECLARE_TARGET(INCREMENT) RESULT(K)166!$omp declare target to(RECURSIVE_DECLARE_TARGET) device_type(nohost)167    INTEGER :: INCREMENT, K168    IF (INCREMENT == 10) THEN169        K = INCREMENT170    ELSE171        K = RECURSIVE_DECLARE_TARGET(INCREMENT + 1)172    END IF173END FUNCTION RECURSIVE_DECLARE_TARGET174 175! DEVICE-LABEL: func.func @_QPrecursive_declare_target_enter176! DEVICE-SAME: {{.*}}attributes {omp.declare_target = #omp.declaretarget<device_type = (nohost), capture_clause = (enter), automap = false>{{.*}}177RECURSIVE FUNCTION RECURSIVE_DECLARE_TARGET_ENTER(INCREMENT) RESULT(K)178!$omp declare target enter(RECURSIVE_DECLARE_TARGET_ENTER) device_type(nohost)179    INTEGER :: INCREMENT, K180    IF (INCREMENT == 10) THEN181        K = INCREMENT182    ELSE183        K = RECURSIVE_DECLARE_TARGET_ENTER(INCREMENT + 1)184    END IF185END FUNCTION RECURSIVE_DECLARE_TARGET_ENTER186