37 lines · plain
1! RUN: %flang_fc1 -emit-hlfir %s -o - | FileCheck %s --check-prefixes=CHECK%if target=x86_64{{.*}} %{,CHECK-KIND10%}2 3! CHECK-LABEL: func @_QPspacing_test(4real*4 function spacing_test(x)5 real*4 :: x6 spacing_test = spacing(x)7! CHECK: %[[a1:.*]] = fir.load %{{.*}} : !fir.ref<f32>8! CHECK: %{{.*}} = fir.call @_FortranASpacing4(%[[a1]]) {{.*}}: (f32) -> f329end function10 11! CHECK-KIND10-LABEL: func @_QPspacing_test2(12function spacing_test2(x)13 integer, parameter :: kind10 = merge(10, 4, selected_real_kind(p=18).eq.10)14 real(kind10) :: x, spacing_test215 spacing_test2 = spacing(x)16! CHECK-KIND10: %[[a1:.*]] = fir.load %{{.*}} : !fir.ref<f80>17! CHECK-KIND10: %{{.*}} = fir.call @_FortranASpacing10(%[[a1]]) {{.*}}: (f80) -> f8018end function19 20! CHECK-LABEL: test_real221subroutine test_real2(x, y)22 real(2) :: x, y23 y = spacing(x)24! CHECK: %[[CAST_ARG:.*]] = fir.convert %{{.*}} : (f16) -> f3225! CHECK: %[[RT_RES:.*]] = fir.call @_FortranASpacing2By4(%[[CAST_ARG]]){{.*}}: (f32) -> f3226! CHECK: fir.convert %[[RT_RES]] : (f32) -> f1627end subroutine28 29! CHECK-LABEL: test_real330subroutine test_real3(x, y)31 real(3) :: x, y32 y = spacing(x)33! CHECK: %[[CAST_ARG:.*]] = fir.convert %{{.*}} : (bf16) -> f3234! CHECK: %[[RT_RES:.*]] = fir.call @_FortranASpacing3By4(%[[CAST_ARG]]){{.*}}: (f32) -> f3235! CHECK: fir.convert %[[RT_RES]] : (f32) -> bf1636end subroutine37