[ConstraintElim] Add support for decomposing gep nuw (#118639)
[llvm-project.git] / flang / test / Lower / logical-operations.f90
blob445563ead0d28ca72d9fac6c57a0564dd35adf8f
1 ! RUN: bbc -hlfir=false %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)
7 LOGICAL(1) :: x0
8 LOGICAL(1) :: 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
16 END FUNCTION
18 ! CHECK-LABEL:neqv1_test
19 LOGICAL(1) FUNCTION neqv1_test(x0, x1)
20 LOGICAL(1) :: x0
21 LOGICAL(1) :: 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
29 END FUNCTION
31 ! CHECK-LABEL:or2_test
32 LOGICAL(1) FUNCTION or2_test(x0, x1)
33 LOGICAL(1) :: x0
34 LOGICAL(1) :: 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>
41 or2_test = x0 .OR. x1
42 END FUNCTION
44 ! CHECK-LABEL:and3_test
45 LOGICAL(1) FUNCTION and3_test(x0, x1)
46 LOGICAL(1) :: x0
47 LOGICAL(1) :: 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
55 END FUNCTION
57 ! CHECK-LABEL:not4_test
58 LOGICAL(1) FUNCTION not4_test(x0)
59 LOGICAL(1) :: 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>
64 not4_test = .NOT. x0
65 END FUNCTION