[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Lower / Intrinsics / exp.f90
blob539ed6468b770ba90835582e896df26b6fe4fe6e
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: exp_testr
9 ! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<f32> {{.*}}, %[[BREF:.*]]: !fir.ref<f32> {{.*}})
10 subroutine exp_testr(a, b)
11 real :: a, b
12 ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<f32>
13 ! CHECK: %[[RES:.*]] = fir.call @fir.exp.f32.f32(%[[A]]) {{.*}}: (f32) -> f32
14 ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<f32>
15 b = exp(a)
16 end subroutine
18 ! CHECK-LABEL: exp_testd
19 ! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<f64> {{.*}}, %[[BREF:.*]]: !fir.ref<f64> {{.*}})
20 subroutine exp_testd(a, b)
21 real(kind=8) :: a, b
22 ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<f64>
23 ! CHECK: %[[RES:.*]] = fir.call @fir.exp.f64.f64(%[[A]]) {{.*}}: (f64) -> f64
24 ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<f64>
25 b = exp(a)
26 end subroutine
28 ! CHECK-LABEL: exp_testc
29 ! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<!fir.complex<4>> {{.*}}, %[[BREF:.*]]: !fir.ref<!fir.complex<4>> {{.*}})
30 subroutine exp_testc(a, b)
31 complex :: a, b
32 ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<!fir.complex<4>>
33 ! CHECK: %[[RES:.*]] = fir.call @fir.exp.z4.z4(%[[A]]) {{.*}}: (!fir.complex<4>) -> !fir.complex<4>
34 ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<!fir.complex<4>>
35 b = exp(a)
36 end subroutine
38 ! CHECK-LABEL: exp_testcd
39 ! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<!fir.complex<8>> {{.*}}, %[[BREF:.*]]: !fir.ref<!fir.complex<8>> {{.*}})
40 subroutine exp_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.exp.z8.z8(%[[A]]) {{.*}}: (!fir.complex<8>) -> !fir.complex<8>
44 ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<!fir.complex<8>>
45 b = exp(a)
46 end subroutine
48 ! CHECK-LABEL: private @fir.exp.f32.f32
49 ! CHECK-SAME: (%[[ARG32_OUTLINE:.*]]: f32) -> f32
50 ! CHECK: %[[RESULT32_OUTLINE:.*]] = math.exp %[[ARG32_OUTLINE]] : f32
51 ! CHECK: return %[[RESULT32_OUTLINE]] : f32
53 ! CHECK-LABEL: private @fir.exp.f64.f64
54 ! CHECK-SAME: (%[[ARG64_OUTLINE:.*]]: f64) -> f64
55 ! CHECK: %[[RESULT64_OUTLINE:.*]] = math.exp %[[ARG64_OUTLINE]] : f64
56 ! CHECK: return %[[RESULT64_OUTLINE]] : f64
58 ! CMPLX-LABEL: private @fir.exp.z4.z4
59 ! CMPLX-SAME: (%[[ARG32_OUTLINE:.*]]: !fir.complex<4>) -> !fir.complex<4>
60 ! CMPLX-FAST: %[[C:.*]] = fir.convert %[[ARG32_OUTLINE]] : (!fir.complex<4>) -> complex<f32>
61 ! CMPLX-FAST: %[[E:.*]] = complex.exp %[[C]] : complex<f32>
62 ! CMPLX-FAST: %[[RESULT32_OUTLINE:.*]] = fir.convert %[[E]] : (complex<f32>) -> !fir.complex<4>
63 ! CMPLX-PRECISE: %[[RESULT32_OUTLINE:.*]] = fir.call @cexpf(%[[ARG32_OUTLINE]]) : (!fir.complex<4>) -> !fir.complex<4>
64 ! CMPLX: return %[[RESULT32_OUTLINE]] : !fir.complex<4>
66 ! CMPLX-LABEL: private @fir.exp.z8.z8
67 ! CMPLX-SAME: (%[[ARG64_OUTLINE:.*]]: !fir.complex<8>) -> !fir.complex<8>
68 ! CMPLX-FAST: %[[C:.*]] = fir.convert %[[ARG64_OUTLINE]] : (!fir.complex<8>) -> complex<f64>
69 ! CMPLX-FAST: %[[E:.*]] = complex.exp %[[C]] : complex<f64>
70 ! CMPLX-FAST: %[[RESULT64_OUTLINE:.*]] = fir.convert %[[E]] : (complex<f64>) -> !fir.complex<8>
71 ! CMPLX-PRECISE: %[[RESULT64_OUTLINE:.*]] = fir.call @cexp(%[[ARG64_OUTLINE]]) : (!fir.complex<8>) -> !fir.complex<8>
72 ! CMPLX: return %[[RESULT64_OUTLINE]] : !fir.complex<8>