| 1 |
! RUN: bbc %s -o - | FileCheck %s |
| 2 |
|
| 3 |
! CHECK-LABEL: sign_testi |
| 4 |
subroutine sign_testi(a, b, c) |
| 5 |
integer a, b, c |
| 6 |
! CHECK: %[[VAL_1:.*]] = arith.shrsi %{{.*}}, %{{.*}} : i32 |
| 7 |
! CHECK: %[[VAL_2:.*]] = arith.xori %{{.*}}, %[[VAL_1]] : i32 |
| 8 |
! CHECK: %[[VAL_3:.*]] = arith.subi %[[VAL_2]], %[[VAL_1]] : i32 |
| 9 |
! CHECK-DAG: %[[VAL_4:.*]] = arith.subi %{{.*}}, %[[VAL_3]] : i32 |
| 10 |
! CHECK-DAG: %[[VAL_5:.*]] = arith.cmpi slt, %{{.*}}, %{{.*}} : i32 |
| 11 |
! CHECK: select %[[VAL_5]], %[[VAL_4]], %[[VAL_3]] : i32 |
| 12 |
c = sign(a, b) |
| 13 |
end subroutine |
| 14 |
|
| 15 |
! CHECK-LABEL: sign_testr |
| 16 |
subroutine sign_testr(a, b, c) |
| 17 |
real a, b, c |
| 18 |
! CHECK-NOT: fir.call @{{.*}}fabs |
| 19 |
! CHECK: math.copysign{{.*}} : f32 |
| 20 |
c = sign(a, b) |
| 21 |
end subroutine |
| 22 |
|
| 23 |
! CHECK-LABEL: sign_testr2 |
| 24 |
subroutine sign_testr2(a, b, c) |
| 25 |
real(KIND=16) a, b, c |
| 26 |
! CHECK-NOT: fir.call @{{.*}}fabs |
| 27 |
! CHECK: math.copysign{{.*}} : f128 |
| 28 |
c = sign(a, b) |
| 29 |
end subroutine |