brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.8 KiB · f6ea8d2 Raw
117 lines · plain
1! RUN: bbc -emit-fir -hlfir=false %s -o - --math-runtime=fast | FileCheck --check-prefixes=ALL %s2! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -mllvm -math-runtime=fast %s -o - | FileCheck --check-prefixes=ALL %s3! RUN: bbc -emit-fir -hlfir=false %s -o - --math-runtime=relaxed | FileCheck --check-prefixes=ALL %s4! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -mllvm -math-runtime=relaxed %s -o - | FileCheck --check-prefixes=ALL %s5! RUN: bbc -emit-fir -hlfir=false %s -o - --math-runtime=precise | FileCheck --check-prefixes=ALL %s6! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -mllvm -math-runtime=precise %s -o - | FileCheck --check-prefixes=ALL %s7 8! ALL-LABEL: @_QPtest_real49! ALL-SAME: (%[[argx:.*]]: !fir.ref<f32>{{.*}}, %[[argn:.*]]: !fir.ref<i32>{{.*}}) -> f3210function test_real4(x, n)11  real :: x, test_real412  integer :: n13 14  ! ALL-DAG: %[[x:.*]] = fir.load %[[argx]] : !fir.ref<f32>15  ! ALL-DAG: %[[n:.*]] = fir.load %[[argn]] : !fir.ref<i32>16  ! ALL: fir.call @jnf(%[[n]], %[[x]]) {{.*}} : (i32, f32) -> f3217  test_real4 = bessel_jn(n, x)18end function19 20! ALL-LABEL: @_QPtest_real821! ALL-SAME: (%[[argx:.*]]: !fir.ref<f64>{{.*}}, %[[argn:.*]]: !fir.ref<i32>{{.*}}) -> f6422function test_real8(x, n)23  real(8) :: x, test_real824  integer :: n25 26  ! ALL-DAG: %[[x:.*]] = fir.load %[[argx]] : !fir.ref<f64>27  ! ALL-DAG: %[[n:.*]] = fir.load %[[argn]] : !fir.ref<i32>28  ! ALL: fir.call @jn(%[[n]], %[[x]]) {{.*}} : (i32, f64) -> f6429  test_real8 = bessel_jn(n, x)30end function31 32! ALL-LABEL: @_QPtest_transformational_real433! ALL-SAME: %[[argx:.*]]: !fir.ref<f32>{{.*}}, %[[argn1:.*]]: !fir.ref<i32>{{.*}}, %[[argn2:.*]]: !fir.ref<i32>{{.*}}34subroutine test_transformational_real4(x, n1, n2, r)35  real(4) :: x36  integer :: n1, n237  real(4) :: r(:)38 39  ! ALL-DAG: %[[zero:.*]] = arith.constant 0{{.*}} : f3240  ! ALL-DAG: %[[one:.*]] = arith.constant 1 : i3241  ! ALL-DAG: %[[r:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>>42  ! ALL-DAG: %[[x:.*]] = fir.load %[[argx]] : !fir.ref<f32>43  ! ALL-DAG: %[[n1:.*]] = fir.load %[[argn1]] : !fir.ref<i32>44  ! ALL-DAG: %[[n2:.*]] = fir.load %[[argn2]] : !fir.ref<i32>45  ! ALL-DAG: %[[xeq0:.*]] = arith.cmpf ueq, %[[x]], %[[zero]] {{.*}} : f3246  ! ALL-DAG: %[[n1ltn2:.*]] = arith.cmpi slt, %[[n1]], %[[n2]] : i3247  ! ALL-DAG: %[[n1eqn2:.*]] = arith.cmpi eq, %[[n1]], %[[n2]] : i3248  ! ALL: fir.if %[[xeq0]] {49  ! ALL: %[[resxeq0:.*]] = fir.convert %[[r]] {{.*}}50  ! ALL: fir.call @_FortranABesselJnX0_4(%[[resxeq0]], %[[n1]], %[[n2]], {{.*}}, {{.*}}) {{.*}} : (!fir.ref<!fir.box<none>>, i32, i32, !fir.ref<i8>, i32) -> ()51  ! ALL-NEXT: } else {52  ! ALL-NEXT: fir.if %[[n1ltn2]] {53  ! ALL-DAG: %[[n2_1:.*]] = arith.subi %[[n2]], %[[one]] : i3254  ! ALL-DAG: %[[bn2:.*]] = fir.call @jnf(%[[n2]], %[[x]]) {{.*}} : (i32, f32) -> f3255  ! ALL-DAG: %[[bn2_1:.*]] = fir.call @jnf(%[[n2_1]], %[[x]]) {{.*}} : (i32, f32) -> f3256  ! ALL-DAG: %[[resn1ltn2:.*]] = fir.convert %[[r]] {{.*}}57  ! ALL: fir.call @_FortranABesselJn_4(%[[resn1ltn2]], %[[n1]], %[[n2]], %[[x]], %[[bn2]], %[[bn2_1]], {{.*}}, {{.*}}) {{.*}} : (!fir.ref<!fir.box<none>>, i32, i32, f32, f32, f32, !fir.ref<i8>, i32) -> ()58  ! ALL-NEXT: } else {59  ! ALL-NEXT: fir.if %[[n1eqn2]] {60  ! ALL-DAG: %[[bn2:.*]] = fir.call @jnf(%[[n2]], %[[x]]) {{.*}} : (i32, f32) -> f3261  ! ALL-DAG: %[[resn1eqn2:.*]] = fir.convert %[[r]] {{.*}}62  ! ALL: fir.call @_FortranABesselJn_4(%[[resn1eqn2]], %[[n1]], %[[n2]], %[[x]], %[[bn2]], %[[zero]], {{.*}}, {{.*}}) {{.*}} : (!fir.ref<!fir.box<none>>, i32, i32, f32, f32, f32, !fir.ref<i8>, i32) -> ()63  ! ALL-NEXT: } else {64  ! ALL-DAG: %[[resn1gtn2:.*]] = fir.convert %[[r]] {{.*}}65  ! ALL: fir.call @_FortranABesselJn_4(%[[resn1gtn2]], %[[n1]], %[[n2]], %[[x]], %[[zero]], %[[zero]], {{.*}}, {{.*}}) {{.*}} : (!fir.ref<!fir.box<none>>, i32, i32, f32, f32, f32, !fir.ref<i8>, i32) -> ()66  ! ALL-NEXT: }67  ! ALL-NEXT: }68  ! ALL-NEXT: }69  r = bessel_jn(n1, n2, x)70  ! ALL: %[[box:.*]] = fir.load %[[r]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>71  ! ALL: %[[addr:.*]] = fir.box_addr %[[box]] : (!fir.box<!fir.heap<!fir.array<?xf32>>>) -> !fir.heap<!fir.array<?xf32>>72  ! ALL: fir.freemem %[[addr]] : !fir.heap<!fir.array<?xf32>>73end subroutine test_transformational_real474 75! ALL-LABEL: @_QPtest_transformational_real876! ALL-SAME: %[[argx:.*]]: !fir.ref<f64>{{.*}}, %[[argn1:.*]]: !fir.ref<i32>{{.*}}, %[[argn2:.*]]: !fir.ref<i32>{{.*}}77subroutine test_transformational_real8(x, n1, n2, r)78  real(8) :: x79  integer :: n1, n280  real(8) :: r(:)81 82  ! ALL-DAG: %[[zero:.*]] = arith.constant 0{{.*}} : f6483  ! ALL-DAG: %[[one:.*]] = arith.constant 1 : i3284  ! ALL-DAG: %[[r:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?xf64>>>85  ! ALL-DAG: %[[x:.*]] = fir.load %[[argx]] : !fir.ref<f64>86  ! ALL-DAG: %[[n1:.*]] = fir.load %[[argn1]] : !fir.ref<i32>87  ! ALL-DAG: %[[n2:.*]] = fir.load %[[argn2]] : !fir.ref<i32>88  ! ALL-DAG: %[[xeq0:.*]] = arith.cmpf ueq, %[[x]], %[[zero]] {{.*}} : f6489  ! ALL-DAG: %[[n1ltn2:.*]] = arith.cmpi slt, %[[n1]], %[[n2]] : i3290  ! ALL-DAG: %[[n1eqn2:.*]] = arith.cmpi eq, %[[n1]], %[[n2]] : i3291  ! ALL: fir.if %[[xeq0]] {92  ! ALL: %[[resxeq0:.*]] = fir.convert %[[r]] {{.*}}93  ! ALL: fir.call @_FortranABesselJnX0_8(%[[resxeq0]], %[[n1]], %[[n2]], {{.*}}, {{.*}}) {{.*}} : (!fir.ref<!fir.box<none>>, i32, i32, !fir.ref<i8>, i32) -> ()94  ! ALL-NEXT: } else {95  ! ALL-NEXT: fir.if %[[n1ltn2]] {96  ! ALL-DAG: %[[n2_1:.*]] = arith.subi %[[n2]], %[[one]] : i3297  ! ALL-DAG: %[[bn2:.*]] = fir.call @jn(%[[n2]], %[[x]]) {{.*}} : (i32, f64) -> f6498  ! ALL-DAG: %[[bn2_1:.*]] = fir.call @jn(%[[n2_1]], %[[x]]) {{.*}} : (i32, f64) -> f6499  ! ALL-DAG: %[[resn1ltn2:.*]] = fir.convert %[[r]] {{.*}}100  ! ALL: fir.call @_FortranABesselJn_8(%[[resn1ltn2]], %[[n1]], %[[n2]], %[[x]], %[[bn2]], %[[bn2_1]], {{.*}}, {{.*}}) {{.*}} : (!fir.ref<!fir.box<none>>, i32, i32, f64, f64, f64, !fir.ref<i8>, i32) -> ()101  ! ALL-NEXT: } else {102  ! ALL-NEXT: fir.if %[[n1eqn2]] {103  ! ALL-DAG: %[[bn2:.*]] = fir.call @jn(%[[n2]], %[[x]]) {{.*}} : (i32, f64) -> f64104  ! ALL-DAG: %[[resn1eqn2:.*]] = fir.convert %[[r]] {{.*}}105  ! ALL: fir.call @_FortranABesselJn_8(%[[resn1eqn2]], %[[n1]], %[[n2]], %[[x]], %[[bn2]], %[[zero]], {{.*}}, {{.*}}) {{.*}} : (!fir.ref<!fir.box<none>>, i32, i32, f64, f64, f64, !fir.ref<i8>, i32) -> ()106  ! ALL-NEXT: } else {107  ! ALL-DAG: %[[resn1gtn2:.*]] = fir.convert %[[r]] {{.*}}108  ! ALL: fir.call @_FortranABesselJn_8(%[[resn1gtn2]], %[[n1]], %[[n2]], %[[x]], %[[zero]], %[[zero]], {{.*}}, {{.*}}) {{.*}} : (!fir.ref<!fir.box<none>>, i32, i32, f64, f64, f64, !fir.ref<i8>, i32) -> ()109  ! ALL-NEXT: }110  ! ALL-NEXT: }111  ! ALL-NEXT: }112  r = bessel_jn(n1, n2, x)113  ! ALL: %[[box:.*]] = fir.load %[[r]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf64>>>>114  ! ALL: %[[addr:.*]] = fir.box_addr %[[box]] : (!fir.box<!fir.heap<!fir.array<?xf64>>>) -> !fir.heap<!fir.array<?xf64>>115  ! ALL: fir.freemem %[[addr]] : !fir.heap<!fir.array<?xf64>>116end subroutine test_transformational_real8117