IR: de-duplicate two CmpInst routines (NFC) (#116866)
[llvm-project.git] / flang / test / Lower / io-statement-open-options.f90
blob9f469b2892a6299852abdcea222c1b74e1fcb9ae
1 ! Test lowering of OPEN statment options
2 ! RUN: bbc %s -emit-fir -hlfir=false -o - | FileCheck %s
4 ! CHECK-LABEL: func.func @_QPtest_convert_specifier(
5 subroutine test_convert_specifier(unit)
6 integer :: unit
7 ! CHECK: %[[cookie:.*]] = fir.call @_FortranAioBeginOpenUnit(%{{.*}}, %{{.*}}, %{{.*}}) {{.*}}: (i32, !fir.ref<i8>, i32) -> !fir.ref<i8>
8 ! CHECK: %[[be_str:.*]] = fir.address_of(@[[be_str_name:.*]]) : !fir.ref<!fir.char<1,10>>
9 ! CHECK: %[[len:.*]] = arith.constant 10 : index
10 ! CHECK: %[[be_str_conv:.*]] = fir.convert %[[be_str]] : (!fir.ref<!fir.char<1,10>>) -> !fir.ref<i8>
11 ! CHECK: %[[len_conv:.*]] = fir.convert %[[len]] : (index) -> i64
12 ! CHECK: %{{.*}} = fir.call @_FortranAioSetConvert(%[[cookie]], %[[be_str_conv]], %[[len_conv]]) {{.*}}: (!fir.ref<i8>, !fir.ref<i8>, i64) -> i1
13 ! CHECK: %{{.*}} = fir.call @_FortranAioEndIoStatement(%[[cookie]]) {{.*}}: (!fir.ref<i8>) -> i32
14 open(unit, form="UNFORMATTED", convert="BIG_ENDIAN")
15 close(unit)
16 end subroutine
18 ! CHECK: fir.global linkonce @[[be_str_name]] constant : !fir.char<1,10> {
19 ! CHECK: %[[be_str_lit:.*]] = fir.string_lit "BIG_ENDIAN"(10) : !fir.char<1,10>
20 ! CHECK: fir.has_value %[[be_str_lit]] : !fir.char<1,10>