32 lines · plain
1! RUN: bbc %s -o - | FileCheck %s --check-prefixes=CHECK,%if flang-supports-f128-math %{F128%} %else %{F64%}2 3! CHECK-LABEL: sign_testi4subroutine sign_testi(a, b, c)5 integer a, b, c6 ! CHECK: %[[VAL_1:.*]] = arith.shrsi %{{.*}}, %{{.*}} : i327 ! CHECK: %[[VAL_2:.*]] = arith.xori %{{.*}}, %[[VAL_1]] : i328 ! CHECK: %[[VAL_3:.*]] = arith.subi %[[VAL_2]], %[[VAL_1]] : i329 ! CHECK-DAG: %[[VAL_4:.*]] = arith.subi %{{.*}}, %[[VAL_3]] : i3210 ! CHECK-DAG: %[[VAL_5:.*]] = arith.cmpi slt, %{{.*}}, %{{.*}} : i3211 ! CHECK: select %[[VAL_5]], %[[VAL_4]], %[[VAL_3]] : i3212 c = sign(a, b)13end subroutine14 15! CHECK-LABEL: sign_testr16subroutine sign_testr(a, b, c)17 real a, b, c18 ! CHECK-NOT: fir.call @{{.*}}fabs19 ! CHECK: math.copysign{{.*}} : f3220 c = sign(a, b)21end subroutine22 23! CHECK-LABEL: sign_testr224subroutine sign_testr2(a, b, c)25 integer, parameter :: rk = merge(16, 8, selected_real_kind(33, 4931)==16)26 real(KIND=rk) a, b, c27 ! CHECK-NOT: fir.call @{{.*}}fabs28 ! F128: math.copysign{{.*}} : f12829 ! F64: math.copysign{{.*}} : f6430 c = sign(a, b)31end subroutine32