Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / Intrinsics / exit.f90
blob6c973986e7c2c17beb4f19f5daabfd6ae9fbfe07
1 ! RUN: bbc -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-32 -DDEFAULT_INTEGER_SIZE=32 %s
2 ! bbc doesn't have a way to set the default kinds so we use flang-new driver
3 ! RUN: flang-new -fc1 -fdefault-integer-8 -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-64 -DDEFAULT_INTEGER_SIZE=64 %s
5 ! CHECK-LABEL: func @_QPexit_test1() {
6 subroutine exit_test1
7 call exit()
8 ! CHECK: %[[status:.*]] = arith.constant 0 : i[[DEFAULT_INTEGER_SIZE]]
9 ! CHECK-64: %[[statusConvert:.*]] = fir.convert %[[status]] : (i64) -> i32
10 ! CHECK-32: %{{[0-9]+}} = fir.call @_FortranAExit(%[[status]]) {{.*}}: (i32) -> none
11 ! CHECK-64: %{{[0-9]+}} = fir.call @_FortranAExit(%[[statusConvert]]) {{.*}}: (i32) -> none
12 end subroutine exit_test1
14 ! CHECK-LABEL: func @_QPexit_test2(
15 ! CHECK-SAME: %[[statusArg:.*]]: !fir.ref<i[[DEFAULT_INTEGER_SIZE]]>{{.*}}) {
16 subroutine exit_test2(status)
17 integer :: status
18 call exit(status)
19 ! CHECK: %[[status:.*]] = fir.load %[[statusArg]] : !fir.ref<i[[DEFAULT_INTEGER_SIZE]]>
20 ! CHECK-64: %[[statusConv:.*]] = fir.convert %[[status]] : (i64) -> i32
21 ! CHECK-32: %{{[0-9]+}} = fir.call @_FortranAExit(%[[status]]) {{.*}}: (i32) -> none
22 ! CHECK-64: %{{[0-9]+}} = fir.call @_FortranAExit(%[[statusConv]]) {{.*}}: (i32) -> none
23 end subroutine exit_test2