Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / OpenACC / acc-wait.f90
blob70285999895f77c08a5a2e63510819286e8737ef
1 ! This test checks lowering of OpenACC wait directive.
3 ! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s
5 subroutine acc_update
6 integer :: async = 1
7 logical :: ifCondition = .TRUE.
9 !$acc wait
10 !CHECK: acc.wait{{$}}
12 !$acc wait if(.true.)
13 !CHECK: [[IF1:%.*]] = arith.constant true
14 !CHECK: acc.wait if([[IF1]]){{$}}
16 !$acc wait if(ifCondition)
17 !CHECK: [[IFCOND:%.*]] = fir.load %{{.*}} : !fir.ref<!fir.logical<4>>
18 !CHECK: [[IF2:%.*]] = fir.convert [[IFCOND]] : (!fir.logical<4>) -> i1
19 !CHECK: acc.wait if([[IF2]]){{$}}
21 !$acc wait(1, 2)
22 !CHECK: [[WAIT1:%.*]] = arith.constant 1 : i32
23 !CHECK: [[WAIT2:%.*]] = arith.constant 2 : i32
24 !CHECK: acc.wait([[WAIT1]], [[WAIT2]] : i32, i32){{$}}
26 !$acc wait(1) async
27 !CHECK: [[WAIT3:%.*]] = arith.constant 1 : i32
28 !CHECK: acc.wait([[WAIT3]] : i32) attributes {async}
30 !$acc wait(1) async(async)
31 !CHECK: [[WAIT3:%.*]] = arith.constant 1 : i32
32 !CHECK: [[ASYNC1:%.*]] = fir.load %{{.*}} : !fir.ref<i32>
33 !CHECK: acc.wait([[WAIT3]] : i32) async([[ASYNC1]] : i32){{$}}
35 !$acc wait(devnum: 3: queues: 1, 2)
36 !CHECK: [[WAIT1:%.*]] = arith.constant 1 : i32
37 !CHECK: [[WAIT2:%.*]] = arith.constant 2 : i32
38 !CHECK: [[DEVNUM:%.*]] = arith.constant 3 : i32
39 !CHECK: acc.wait([[WAIT1]], [[WAIT2]] : i32, i32) wait_devnum([[DEVNUM]] : i32){{$}}
41 end subroutine acc_update