| 1 |
! This test checks lowering of OpenACC set directive. |
| 2 |
|
| 3 |
! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK,HLFIR |
| 4 |
|
| 5 |
program test_acc_set |
| 6 |
logical :: l |
| 7 |
|
| 8 |
!$acc set default_async(1) |
| 9 |
|
| 10 |
!$acc set default_async(1) if(l) |
| 11 |
|
| 12 |
!$acc set device_num(0) |
| 13 |
|
| 14 |
!$acc set device_type(*) |
| 15 |
|
| 16 |
!$acc set device_type(multicore) |
| 17 |
|
| 18 |
end |
| 19 |
|
| 20 |
! CHECK-LABEL: func.func @_QQmain() |
| 21 |
! CHECK: %[[L:.*]] = fir.alloca !fir.logical<4> {bindc_name = "l", uniq_name = "_QFEl"} |
| 22 |
! HLFIR: %[[DECLL:.*]]:2 = hlfir.declare %[[L]] {uniq_name = "_QFEl"} |
| 23 |
|
| 24 |
! CHECK: %[[C1:.*]] = arith.constant 1 : i32 |
| 25 |
! CHECK: acc.set default_async(%[[C1]] : i32) |
| 26 |
|
| 27 |
! CHECK: %[[C1:.*]] = arith.constant 1 : i32 |
| 28 |
! FIR: %[[LOAD_L:.*]] = fir.load %[[L]] : !fir.ref<!fir.logical<4>> |
| 29 |
! HLFIR: %[[LOAD_L:.*]] = fir.load %[[DECLL]]#0 : !fir.ref<!fir.logical<4>> |
| 30 |
! CHECK: %[[CONV_L:.*]] = fir.convert %[[LOAD_L]] : (!fir.logical<4>) -> i1 |
| 31 |
! CHECK: acc.set default_async(%[[C1]] : i32) if(%[[CONV_L]]) |
| 32 |
|
| 33 |
! CHECK: %[[C0:.*]] = arith.constant 0 : i32 |
| 34 |
! CHECK: acc.set device_num(%[[C0]] : i32) |
| 35 |
|
| 36 |
! CHECK: acc.set attributes {device_type = #acc.device_type<star>} |
| 37 |
|
| 38 |
! CHECK: acc.set attributes {device_type = #acc.device_type<multicore>} |
| 39 |
|
| 40 |
|