1 ! RUN: bbc %s -o "-" | FileCheck %s
3 ! Test logical intrinsic operation lowering to fir.
5 ! CHECK-LABEL:eqv0_test
6 LOGICAL(1) FUNCTION eqv0_test(x0
, x1
)
9 ! CHECK-DAG:[[reg1:%[0-9]+]] = fir.load %arg0
10 ! CHECK-DAG:[[reg2:%[0-9]+]] = fir.load %arg1
11 ! CHECK-DAG:[[reg3:%[0-9]+]] = fir.convert [[reg1]] {{.*}} -> i1
12 ! CHECK-DAG:[[reg4:%[0-9]+]] = fir.convert [[reg2]] {{.*}} -> i1
13 ! CHECK:[[reg5:%[0-9]+]] = arith.cmpi eq, [[reg3]], [[reg4]]
14 ! CHECK:fir.convert [[reg5]] {{.*}} -> !fir.logical<1>
15 eqv0_test
= x0
.EQV
. x1
18 ! CHECK-LABEL:neqv1_test
19 LOGICAL(1) FUNCTION neqv1_test(x0
, x1
)
22 ! CHECK-DAG:[[reg1:%[0-9]+]] = fir.load %arg0
23 ! CHECK-DAG:[[reg2:%[0-9]+]] = fir.load %arg1
24 ! CHECK-DAG:[[reg3:%[0-9]+]] = fir.convert [[reg1]] {{.*}} -> i1
25 ! CHECK-DAG:[[reg4:%[0-9]+]] = fir.convert [[reg2]] {{.*}} -> i1
26 ! CHECK:[[reg5:%[0-9]+]] = arith.cmpi ne, [[reg3]], [[reg4]]
27 ! CHECK:fir.convert [[reg5]] {{.*}} -> !fir.logical<1>
28 neqv1_test
= x0
.NEQV
. x1
31 ! CHECK-LABEL:or2_test
32 LOGICAL(1) FUNCTION or2_test(x0
, x1
)
35 ! CHECK-DAG:[[reg1:%[0-9]+]] = fir.load %arg0
36 ! CHECK-DAG:[[reg2:%[0-9]+]] = fir.load %arg1
37 ! CHECK-DAG:[[reg3:%[0-9]+]] = fir.convert [[reg1]] {{.*}} -> i1
38 ! CHECK-DAG:[[reg4:%[0-9]+]] = fir.convert [[reg2]] {{.*}} -> i1
39 ! CHECK:[[reg5:%[0-9]+]] = arith.ori [[reg3]], [[reg4]]
40 ! CHECK:fir.convert [[reg5]] {{.*}} -> !fir.logical<1>
44 ! CHECK-LABEL:and3_test
45 LOGICAL(1) FUNCTION and3_test(x0
, x1
)
48 ! CHECK-DAG:[[reg1:%[0-9]+]] = fir.load %arg0
49 ! CHECK-DAG:[[reg2:%[0-9]+]] = fir.load %arg1
50 ! CHECK-DAG:[[reg3:%[0-9]+]] = fir.convert [[reg1]] {{.*}} -> i1
51 ! CHECK-DAG:[[reg4:%[0-9]+]] = fir.convert [[reg2]] {{.*}} -> i1
52 ! CHECK:[[reg5:%[0-9]+]] = arith.andi [[reg3]], [[reg4]]
53 ! CHECK:fir.convert [[reg5]] {{.*}} -> !fir.logical<1>
54 and3_test
= x0
.AND
. x1
57 ! CHECK-LABEL:not4_test
58 LOGICAL(1) FUNCTION not4_test(x0
)
60 ! CHECK:[[reg1:%[0-9]+]] = fir.load %arg0
61 ! CHECK:[[reg2:%[0-9]+]] = fir.convert [[reg1]] {{.*}} -> i1
62 ! CHECK:[[reg3:%[0-9]+]] = arith.xori [[reg2]], %true
63 ! CHECK:fir.convert [[reg3]] {{.*}} -> !fir.logical<1>