2 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
4 ! CHECK-LABEL: func.func @_QPselected_int_kind_test1(
5 ! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i8> {fir.bindc_name = "a"}) {
6 ! CHECK: %[[VAL_1:.*]] = fir.alloca i8 {bindc_name = "res", uniq_name = "_QFselected_int_kind_test1Eres"}
7 ! CHECK: %[[VAL_4:.*]] = arith.constant 1 : i32
8 ! CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_0]] : (!fir.ref<i8>) -> !fir.llvm_ptr<i8>
9 ! CHECK: %[[VAL_7:.*]] = fir.call @_FortranASelectedIntKind(%{{.*}}, %{{.*}}, %[[VAL_6]], %[[VAL_4]]) {{.*}}: (!fir.ref<i8>, i32, !fir.llvm_ptr<i8>, i32) -> i32
10 ! CHECK: %[[VAL_8:.*]] = fir.convert %[[VAL_7]] : (i32) -> i8
11 ! CHECK: fir.store %[[VAL_8]] to %[[VAL_1]] : !fir.ref<i8>
15 subroutine selected_int_kind_test1(a
)
17 res
= selected_int_kind(a
)
20 ! CHECK-LABEL: func.func @_QPselected_int_kind_test2(
21 ! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i16> {fir.bindc_name = "a"}) {
22 ! CHECK: %[[VAL_1:.*]] = fir.alloca i16 {bindc_name = "res", uniq_name = "_QFselected_int_kind_test2Eres"}
23 ! CHECK: %[[VAL_4:.*]] = arith.constant 2 : i32
24 ! CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_0]] : (!fir.ref<i16>) -> !fir.llvm_ptr<i8>
25 ! CHECK: %[[VAL_7:.*]] = fir.call @_FortranASelectedIntKind(%{{.*}}, %{{.*}}, %[[VAL_6]], %[[VAL_4]]) {{.*}}: (!fir.ref<i8>, i32, !fir.llvm_ptr<i8>, i32) -> i32
26 ! CHECK: %[[VAL_8:.*]] = fir.convert %[[VAL_7]] : (i32) -> i16
27 ! CHECK: fir.store %[[VAL_8]] to %[[VAL_1]] : !fir.ref<i16>
31 subroutine selected_int_kind_test2(a
)
33 res
= selected_int_kind(a
)
36 ! CHECK-LABEL: func.func @_QPselected_int_kind_test4(
37 ! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i32> {fir.bindc_name = "a"}) {
38 ! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "res", uniq_name = "_QFselected_int_kind_test4Eres"}
39 ! CHECK: %[[VAL_4:.*]] = arith.constant 4 : i32
40 ! CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_0]] : (!fir.ref<i32>) -> !fir.llvm_ptr<i8>
41 ! CHECK: %[[VAL_7:.*]] = fir.call @_FortranASelectedIntKind(%{{.*}}, %{{.*}}, %[[VAL_6]], %[[VAL_4]]) {{.*}}: (!fir.ref<i8>, i32, !fir.llvm_ptr<i8>, i32) -> i32
42 ! CHECK: fir.store %[[VAL_7]] to %[[VAL_1]] : !fir.ref<i32>
46 subroutine selected_int_kind_test4(a
)
48 res
= selected_int_kind(a
)
51 ! CHECK-LABEL: func.func @_QPselected_int_kind_test8(
52 ! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i64> {fir.bindc_name = "a"}) {
53 ! CHECK: %[[VAL_1:.*]] = fir.alloca i64 {bindc_name = "res", uniq_name = "_QFselected_int_kind_test8Eres"}
54 ! CHECK: %[[VAL_4:.*]] = arith.constant 8 : i32
55 ! CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_0]] : (!fir.ref<i64>) -> !fir.llvm_ptr<i8>
56 ! CHECK: %[[VAL_7:.*]] = fir.call @_FortranASelectedIntKind(%{{.*}}, %{{.*}}, %[[VAL_6]], %[[VAL_4]]) {{.*}}: (!fir.ref<i8>, i32, !fir.llvm_ptr<i8>, i32) -> i32
57 ! CHECK: %[[VAL_8:.*]] = fir.convert %[[VAL_7]] : (i32) -> i64
58 ! CHECK: fir.store %[[VAL_8]] to %[[VAL_1]] : !fir.ref<i64>
62 subroutine selected_int_kind_test8(a
)
64 res
= selected_int_kind(a
)
67 ! CHECK-LABEL: func.func @_QPselected_int_kind_test16(
68 ! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i128> {fir.bindc_name = "a"}) {
69 ! CHECK: %[[VAL_1:.*]] = fir.alloca i128 {bindc_name = "res", uniq_name = "_QFselected_int_kind_test16Eres"}
70 ! CHECK: %[[VAL_4:.*]] = arith.constant 16 : i32
71 ! CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_0]] : (!fir.ref<i128>) -> !fir.llvm_ptr<i8>
72 ! CHECK: %[[VAL_7:.*]] = fir.call @_FortranASelectedIntKind(%{{.*}}, %{{.*}}, %[[VAL_6]], %[[VAL_4]]) {{.*}}: (!fir.ref<i8>, i32, !fir.llvm_ptr<i8>, i32) -> i32
73 ! CHECK: %[[VAL_8:.*]] = fir.convert %[[VAL_7]] : (i32) -> i128
74 ! CHECK: fir.store %[[VAL_8]] to %[[VAL_1]] : !fir.ref<i128>
78 subroutine selected_int_kind_test16(a
)
80 res
= selected_int_kind(a
)