[RISCV] Add MIPS P8700 processor (#119882)
[llvm-project.git] / flang / test / Lower / Intrinsics / spacing.f90
blob151f4e2a6d236e2870e0e255ac3fb9d93d9e68a5
1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
2 ! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s
4 ! CHECK-LABEL: func @_QPspacing_test(
5 real*4 function spacing_test(x)
6 real*4 :: x
7 spacing_test = spacing(x)
8 ! CHECK: %[[a1:.*]] = fir.load %{{.*}} : !fir.ref<f32>
9 ! CHECK: %{{.*}} = fir.call @_FortranASpacing4(%[[a1]]) {{.*}}: (f32) -> f32
10 end function
12 ! CHECK-LABEL: func @_QPspacing_test2(
13 real*10 function spacing_test2(x)
14 real*10 :: x
15 spacing_test2 = spacing(x)
16 ! CHECK: %[[a1:.*]] = fir.load %{{.*}} : !fir.ref<f80>
17 ! CHECK: %{{.*}} = fir.call @_FortranASpacing10(%[[a1]]) {{.*}}: (f80) -> f80
18 end function
20 ! CHECK-LABEL: test_real2
21 subroutine test_real2(x, y)
22 real(2) :: x, y
23 y = spacing(x)
24 ! CHECK: %[[CAST_ARG:.*]] = fir.convert %{{.*}} : (f16) -> f32
25 ! CHECK: %[[RT_RES:.*]] = fir.call @_FortranASpacing2By4(%[[CAST_ARG]]){{.*}}: (f32) -> f32
26 ! CHECK: fir.convert %[[RT_RES]] : (f32) -> f16
27 end subroutine
29 ! CHECK-LABEL: test_real3
30 subroutine test_real3(x, y)
31 real(3) :: x, y
32 y = spacing(x)
33 ! CHECK: %[[CAST_ARG:.*]] = fir.convert %{{.*}} : (bf16) -> f32
34 ! CHECK: %[[RT_RES:.*]] = fir.call @_FortranASpacing3By4(%[[CAST_ARG]]){{.*}}: (f32) -> f32
35 ! CHECK: fir.convert %[[RT_RES]] : (f32) -> bf16
36 end subroutine