xref: /llvm-project/flang/test/Lower/OpenACC/stop-stmt-in-region.f90 (revision 12ba74e181bd6641b532e271f3bfabf53066b1c0)
1! This test checks lowering of stop statement in OpenACC region.
2
3! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s
4! RUN: %flang_fc1 -emit-hlfir -fopenacc %s -o - | FileCheck %s
5
6! CHECK-LABEL: func.func @_QPtest_stop_in_region1() {
7! CHECK:         acc.parallel {
8! CHECK:           %[[VAL_0:.*]] = arith.constant 1 : i32
9! CHECK:           %[[VAL_1:.*]] = arith.constant false
10! CHECK:           %[[VAL_2:.*]] = arith.constant false
11! CHECK:           fir.call @_FortranAStopStatement(%[[VAL_0]], %[[VAL_1]], %[[VAL_2]]) {{.*}} : (i32, i1, i1) -> ()
12! CHECK:           acc.yield
13! CHECK:         }
14! CHECK:         return
15! CHECK:       }
16
17subroutine test_stop_in_region1()
18  !$acc parallel
19    stop 1
20  !$acc end parallel
21end
22
23! CHECK-LABEL: func.func @_QPtest_stop_in_region2() {
24! CHECK:         %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFtest_stop_in_region2Ex"}
25! CHECK:         acc.parallel {
26! CHECK:           %[[VAL_1:.*]] = arith.constant 1 : i32
27! CHECK:           %[[VAL_2:.*]] = arith.constant false
28! CHECK:           %[[VAL_3:.*]] = arith.constant false
29! CHECK:           fir.call @_FortranAStopStatement(%[[VAL_1]], %[[VAL_2]], %[[VAL_3]]) {{.*}} : (i32, i1, i1) -> ()
30! CHECK:           acc.yield
31! CHECK:         }
32! CHECK:         return
33! CHECK:       }
34
35subroutine test_stop_in_region2()
36  integer :: x
37  !$acc parallel
38    stop 1
39    x = 2
40  !$acc end parallel
41end
42