1 ! RUN: bbc -hlfir=false %s -o "-" | FileCheck %s
3 ! Test integer intrinsic operation lowering to fir.
6 LOGICAL FUNCTION eq0_test(x0
, x1
)
9 ! CHECK-DAG:[[reg1:%[0-9]+]] = fir.load %arg0
10 ! CHECK-DAG:[[reg2:%[0-9]+]] = fir.load %arg1
11 ! CHECK:[[reg3:%[0-9]+]] = arith.cmpi eq, [[reg1]], [[reg2]] : i32
12 ! CHECK:fir.convert [[reg3]] {{.*}} -> !fir.logical<4>
16 ! CHECK-LABEL:ne1_test
17 LOGICAL FUNCTION ne1_test(x0
, x1
)
20 ! CHECK-DAG:[[reg1:%[0-9]+]] = fir.load %arg0
21 ! CHECK-DAG:[[reg2:%[0-9]+]] = fir.load %arg1
22 ! CHECK:[[reg3:%[0-9]+]] = arith.cmpi ne, [[reg1]], [[reg2]] : i32
23 ! CHECK:fir.convert [[reg3]] {{.*}} -> !fir.logical<4>
27 ! CHECK-LABEL:lt2_test
28 LOGICAL FUNCTION lt2_test(x0
, x1
)
31 ! CHECK-DAG:[[reg1:%[0-9]+]] = fir.load %arg0
32 ! CHECK-DAG:[[reg2:%[0-9]+]] = fir.load %arg1
33 ! CHECK:[[reg3:%[0-9]+]] = arith.cmpi slt, [[reg1]], [[reg2]] : i32
34 ! CHECK:fir.convert [[reg3]] {{.*}} -> !fir.logical<4>
38 ! CHECK-LABEL:le3_test
39 LOGICAL FUNCTION le3_test(x0
, x1
)
42 ! CHECK-DAG:[[reg1:%[0-9]+]] = fir.load %arg0
43 ! CHECK-DAG:[[reg2:%[0-9]+]] = fir.load %arg1
44 ! CHECK:[[reg3:%[0-9]+]] = arith.cmpi sle, [[reg1]], [[reg2]] : i32
45 ! CHECK:fir.convert [[reg3]] {{.*}} -> !fir.logical<4>
49 ! CHECK-LABEL:gt4_test
50 LOGICAL FUNCTION gt4_test(x0
, x1
)
53 ! CHECK-DAG:[[reg1:%[0-9]+]] = fir.load %arg0
54 ! CHECK-DAG:[[reg2:%[0-9]+]] = fir.load %arg1
55 ! CHECK:[[reg3:%[0-9]+]] = arith.cmpi sgt, [[reg1]], [[reg2]] : i32
56 ! CHECK:fir.convert [[reg3]] {{.*}} -> !fir.logical<4>
60 ! CHECK-LABEL:ge5_test
61 LOGICAL FUNCTION ge5_test(x0
, x1
)
64 ! CHECK-DAG:[[reg1:%[0-9]+]] = fir.load %arg0
65 ! CHECK-DAG:[[reg2:%[0-9]+]] = fir.load %arg1
66 ! CHECK:[[reg3:%[0-9]+]] = arith.cmpi sge, [[reg1]], [[reg2]] : i32
67 ! CHECK:fir.convert [[reg3]] {{.*}} -> !fir.logical<4>
71 ! CHECK-LABEL:add6_test
72 INTEGER(4) FUNCTION add6_test(x0
, x1
)
75 ! CHECK-DAG:[[reg1:%[0-9]+]] = fir.load %arg0
76 ! CHECK-DAG:[[reg2:%[0-9]+]] = fir.load %arg1
77 ! CHECK:addi [[reg1]], [[reg2]] : i32
81 ! CHECK-LABEL:sub7_test
82 INTEGER(4) FUNCTION sub7_test(x0
, x1
)
85 ! CHECK-DAG:[[reg1:%[0-9]+]] = fir.load %arg0
86 ! CHECK-DAG:[[reg2:%[0-9]+]] = fir.load %arg1
87 ! CHECK:subi [[reg1]], [[reg2]] : i32
91 ! CHECK-LABEL:mult8_test
92 INTEGER(4) FUNCTION mult8_test(x0
, x1
)
95 ! CHECK-DAG:[[reg1:%[0-9]+]] = fir.load %arg0
96 ! CHECK-DAG:[[reg2:%[0-9]+]] = fir.load %arg1
97 ! CHECK:muli [[reg1]], [[reg2]] : i32
101 ! CHECK-LABEL:div9_test
102 INTEGER(4) FUNCTION div9_test(x0
, x1
)
105 ! CHECK-DAG:[[reg1:%[0-9]+]] = fir.load %arg0
106 ! CHECK-DAG:[[reg2:%[0-9]+]] = fir.load %arg1
107 ! CHECK:arith.divsi [[reg1]], [[reg2]] : i32