1 ! RUN: bbc -emit-fir -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CHECK,CMPLX,CMPLX-FAST"
2 ! RUN: bbc -emit-fir --math-runtime=precise -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-PRECISE"
3 ! RUN: bbc -emit-fir --disable-mlir-complex -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-PRECISE"
4 ! RUN: %flang_fc1 -emit-fir -mllvm -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CHECK,CMPLX,CMPLX-FAST"
5 ! RUN: %flang_fc1 -emit-fir -mllvm -outline-intrinsics -mllvm --math-runtime=precise %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-PRECISE"
6 ! RUN: %flang_fc1 -emit-fir -mllvm -outline-intrinsics -mllvm --disable-mlir-complex %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-PRECISE"
8 ! CHECK-LABEL: log_testr
9 ! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<f32> {{.*}}, %[[BREF:.*]]: !fir.ref<f32> {{.*}})
10 subroutine log_testr(a
, b
)
12 ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<f32>
13 ! CHECK: %[[RES:.*]] = fir.call @fir.log.f32.f32(%[[A]]) {{.*}}: (f32) -> f32
14 ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<f32>
18 ! CHECK-LABEL: log_testd
19 ! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<f64> {{.*}}, %[[BREF:.*]]: !fir.ref<f64> {{.*}})
20 subroutine log_testd(a
, b
)
22 ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<f64>
23 ! CHECK: %[[RES:.*]] = fir.call @fir.log.f64.f64(%[[A]]) {{.*}}: (f64) -> f64
24 ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<f64>
28 ! CHECK-LABEL: log_testc
29 ! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<!fir.complex<4>> {{.*}}, %[[BREF:.*]]: !fir.ref<!fir.complex<4>> {{.*}})
30 subroutine log_testc(a
, b
)
32 ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<!fir.complex<4>>
33 ! CHECK: %[[RES:.*]] = fir.call @fir.log.z4.z4(%[[A]]) {{.*}}: (!fir.complex<4>) -> !fir.complex<4>
34 ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<!fir.complex<4>>
38 ! CHECK-LABEL: log_testcd
39 ! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<!fir.complex<8>> {{.*}}, %[[BREF:.*]]: !fir.ref<!fir.complex<8>> {{.*}})
40 subroutine log_testcd(a
, b
)
41 complex(kind
=8) :: a
, b
42 ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<!fir.complex<8>>
43 ! CHECK: %[[RES:.*]] = fir.call @fir.log.z8.z8(%[[A]]) {{.*}}: (!fir.complex<8>) -> !fir.complex<8>
44 ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<!fir.complex<8>>
48 ! CHECK-LABEL: log10_testr
49 ! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<f32> {{.*}}, %[[BREF:.*]]: !fir.ref<f32> {{.*}})
50 subroutine log10_testr(a
, b
)
52 ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<f32>
53 ! CHECK: %[[RES:.*]] = fir.call @fir.log10.f32.f32(%[[A]]) {{.*}}: (f32) -> f32
54 ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<f32>
58 ! CHECK-LABEL: log10_testd
59 ! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<f64> {{.*}}, %[[BREF:.*]]: !fir.ref<f64> {{.*}})
60 subroutine log10_testd(a
, b
)
62 ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<f64>
63 ! CHECK: %[[RES:.*]] = fir.call @fir.log10.f64.f64(%[[A]]) {{.*}}: (f64) -> f64
64 ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<f64>
68 ! CHECK-LABEL: private @fir.log.f32.f32
69 ! CHECK-SAME: (%[[ARG32_OUTLINE:.*]]: f32) -> f32
70 ! CHECK: %[[RESULT32_OUTLINE:.*]] = math.log %[[ARG32_OUTLINE]] : f32
71 ! CHECK: return %[[RESULT32_OUTLINE]] : f32
73 ! CHECK-LABEL: private @fir.log.f64.f64
74 ! CHECK-SAME: (%[[ARG64_OUTLINE:.*]]: f64) -> f64
75 ! CHECK: %[[RESULT64_OUTLINE:.*]] = math.log %[[ARG64_OUTLINE]] : f64
76 ! CHECK: return %[[RESULT64_OUTLINE]] : f64
78 ! CMPLX-LABEL: private @fir.log.z4.z4
79 ! CMPLX-SAME: (%[[ARG32_OUTLINE:.*]]: !fir.complex<4>) -> !fir.complex<4>
80 ! CMPLX-FAST: %[[C:.*]] = fir.convert %[[ARG32_OUTLINE]] : (!fir.complex<4>) -> complex<f32>
81 ! CMPLX-FAST: %[[E:.*]] = complex.log %[[C]] : complex<f32>
82 ! CMPLX-FAST: %[[RESULT32_OUTLINE:.*]] = fir.convert %[[E]] : (complex<f32>) -> !fir.complex<4>
83 ! CMPLX-PRECISE: %[[RESULT32_OUTLINE:.*]] = fir.call @clogf(%[[ARG32_OUTLINE]]) : (!fir.complex<4>) -> !fir.complex<4>
84 ! CMPLX: return %[[RESULT32_OUTLINE]] : !fir.complex<4>
86 ! CMPLX-LABEL: private @fir.log.z8.z8
87 ! CMPLX-SAME: (%[[ARG64_OUTLINE:.*]]: !fir.complex<8>) -> !fir.complex<8>
88 ! CMPLX-FAST: %[[C:.*]] = fir.convert %[[ARG64_OUTLINE]] : (!fir.complex<8>) -> complex<f64>
89 ! CMPLX-FAST: %[[E:.*]] = complex.log %[[C]] : complex<f64>
90 ! CMPLX-FAST: %[[RESULT64_OUTLINE:.*]] = fir.convert %[[E]] : (complex<f64>) -> !fir.complex<8>
91 ! CMPLX-PRECISE: %[[RESULT64_OUTLINE:.*]] = fir.call @clog(%[[ARG64_OUTLINE]]) : (!fir.complex<8>) -> !fir.complex<8>
92 ! CMPLX: return %[[RESULT64_OUTLINE]] : !fir.complex<8>
94 ! CHECK-LABEL: private @fir.log10.f32.f32
95 ! CHECK-SAME: (%[[ARG32_OUTLINE:.*]]: f32) -> f32
96 ! CHECK: %[[RESULT32_OUTLINE:.*]] = math.log10 %[[ARG32_OUTLINE]] : f32
97 ! CHECK: return %[[RESULT32_OUTLINE]] : f32
99 ! CHECK-LABEL: private @fir.log10.f64.f64
100 ! CHECK-SAME: (%[[ARG64_OUTLINE:.*]]: f64) -> f64
101 ! CHECK: %[[RESULT64_OUTLINE:.*]] = math.log10 %[[ARG64_OUTLINE]] : f64
102 ! CHECK: return %[[RESULT64_OUTLINE]] : f64