| 1 |
! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s |
| 2 |
|
| 3 |
! CHECK-LABEL: iand_test |
| 4 |
! CHECK-SAME: %[[A:.*]]: !fir.ref<i32>{{.*}}, %[[B:.*]]: !fir.ref<i32>{{.*}}, %[[C:.*]]: !fir.ref<i32>{{.*}} |
| 5 |
subroutine iand_test(a, b, c) |
| 6 |
integer :: a, b, c |
| 7 |
! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i32> |
| 8 |
! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32> |
| 9 |
c = iand(a, b) |
| 10 |
! CHECK: %[[C_VAL:.*]] = arith.andi %[[A_VAL]], %[[B_VAL]] : i32 |
| 11 |
! CHECK: fir.store %[[C_VAL]] to %[[C]] : !fir.ref<i32> |
| 12 |
end subroutine iand_test |
| 13 |
|
| 14 |
! CHECK-LABEL: iand_test1 |
| 15 |
! CHECK-SAME: %[[A:.*]]: !fir.ref<i8>{{.*}}, %[[B:.*]]: !fir.ref<i8>{{.*}}, %[[C:.*]]: !fir.ref<i8>{{.*}} |
| 16 |
subroutine iand_test1(a, b, c) |
| 17 |
integer(kind=1) :: a, b, c |
| 18 |
! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i8> |
| 19 |
! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i8> |
| 20 |
c = iand(a, b) |
| 21 |
! CHECK: %[[C_VAL:.*]] = arith.andi %[[A_VAL]], %[[B_VAL]] : i8 |
| 22 |
! CHECK: fir.store %[[C_VAL]] to %[[C]] : !fir.ref<i8> |
| 23 |
end subroutine iand_test1 |
| 24 |
|
| 25 |
! CHECK-LABEL: iand_test2 |
| 26 |
! CHECK-SAME: %[[A:.*]]: !fir.ref<i16>{{.*}}, %[[B:.*]]: !fir.ref<i16>{{.*}}, %[[C:.*]]: !fir.ref<i16>{{.*}} |
| 27 |
subroutine iand_test2(a, b, c) |
| 28 |
integer(kind=2) :: a, b, c |
| 29 |
! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i16> |
| 30 |
! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i16> |
| 31 |
c = iand(a, b) |
| 32 |
! CHECK: %[[C_VAL:.*]] = arith.andi %[[A_VAL]], %[[B_VAL]] : i16 |
| 33 |
! CHECK: fir.store %[[C_VAL]] to %[[C]] : !fir.ref<i16> |
| 34 |
end subroutine iand_test2 |
| 35 |
|
| 36 |
! CHECK-LABEL: iand_test3 |
| 37 |
! CHECK-SAME: %[[A:.*]]: !fir.ref<i32>{{.*}}, %[[B:.*]]: !fir.ref<i32>{{.*}}, %[[C:.*]]: !fir.ref<i32>{{.*}} |
| 38 |
subroutine iand_test3(a, b, c) |
| 39 |
integer(kind=4) :: a, b, c |
| 40 |
! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i32> |
| 41 |
! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i32> |
| 42 |
c = iand(a, b) |
| 43 |
! CHECK: %[[C_VAL:.*]] = arith.andi %[[A_VAL]], %[[B_VAL]] : i32 |
| 44 |
! CHECK: fir.store %[[C_VAL]] to %[[C]] : !fir.ref<i32> |
| 45 |
end subroutine iand_test3 |
| 46 |
|
| 47 |
! CHECK-LABEL: iand_test4 |
| 48 |
! CHECK-SAME: %[[A:.*]]: !fir.ref<i64>{{.*}}, %[[B:.*]]: !fir.ref<i64>{{.*}}, %[[C:.*]]: !fir.ref<i64>{{.*}} |
| 49 |
subroutine iand_test4(a, b, c) |
| 50 |
integer(kind=8) :: a, b, c |
| 51 |
! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i64> |
| 52 |
! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i64> |
| 53 |
c = iand(a, b) |
| 54 |
! CHECK: %[[C_VAL:.*]] = arith.andi %[[A_VAL]], %[[B_VAL]] : i64 |
| 55 |
! CHECK: fir.store %[[C_VAL]] to %[[C]] : !fir.ref<i64> |
| 56 |
end subroutine iand_test4 |
| 57 |
|
| 58 |
! CHECK-LABEL: iand_test5 |
| 59 |
! CHECK-SAME: %[[A:.*]]: !fir.ref<i128>{{.*}}, %[[B:.*]]: !fir.ref<i128>{{.*}}, %[[C:.*]]: !fir.ref<i128>{{.*}} |
| 60 |
subroutine iand_test5(a, b, c) |
| 61 |
integer(kind=16) :: a, b, c |
| 62 |
! CHECK: %[[A_VAL:.*]] = fir.load %[[A]] : !fir.ref<i128> |
| 63 |
! CHECK: %[[B_VAL:.*]] = fir.load %[[B]] : !fir.ref<i128> |
| 64 |
c = iand(a, b) |
| 65 |
! CHECK: %[[C_VAL:.*]] = arith.andi %[[A_VAL]], %[[B_VAL]] : i128 |
| 66 |
! CHECK: fir.store %[[C_VAL]] to %[[C]] : !fir.ref<i128> |
| 67 |
end subroutine iand_test5 |
| 68 |
|
| 69 |
! CHECK-LABEL: iand_test6 |
| 70 |
! CHECK-SAME: %[[S1:.*]]: !fir.ref<i32>{{.*}}, %[[S2:.*]]: !fir.ref<i32>{{.*}} |
| 71 |
subroutine iand_test6(s1, s2) |
| 72 |
integer :: s1, s2 |
| 73 |
! CHECK-DAG: %[[S1_VAL:.*]] = fir.load %[[S1]] : !fir.ref<i32> |
| 74 |
! CHECK-DAG: %[[S2_VAL:.*]] = fir.load %[[S2]] : !fir.ref<i32> |
| 75 |
stop iand(s1,s2) |
| 76 |
! CHECK-DAG: %[[ANDI:.*]] = arith.andi %[[S1_VAL]], %[[S2_VAL]] : i32 |
| 77 |
! CHECK: fir.call @_FortranAStopStatement(%[[ANDI]], {{.*}}, {{.*}}) {{.*}}: (i32, i1, i1) -> none |
| 78 |
! CHECK-NEXT: fir.unreachable |
| 79 |
end subroutine iand_test6 |