| 1 |
! RUN: bbc -emit-fir -hlfir=false -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CHECK,CMPLX,CMPLX-PRECISE" |
| 2 |
! RUN: bbc -emit-fir -hlfir=false --math-runtime=precise -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-PRECISE" |
| 3 |
! RUN: bbc -emit-fir -hlfir=false --force-mlir-complex -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-FAST,CMPLX-MLIR" |
| 4 |
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -mllvm -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CHECK,CMPLX,CMPLX-PRECISE" |
| 5 |
! RUN: %flang_fc1 -fapprox-func -emit-fir -flang-deprecated-no-hlfir -mllvm -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-APPROX" |
| 6 |
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -mllvm -outline-intrinsics -mllvm --math-runtime=precise %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-PRECISE" |
| 7 |
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -mllvm -outline-intrinsics -mllvm --force-mlir-complex %s -o - | FileCheck %s --check-prefixes="CMPLX,CMPLX-FAST,CMPLX-MLIR" |
| 8 |
|
| 9 |
! CHECK-LABEL: exp_testr |
| 10 |
! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<f32> {{.*}}, %[[BREF:.*]]: !fir.ref<f32> {{.*}}) |
| 11 |
subroutine exp_testr(a, b) |
| 12 |
real :: a, b |
| 13 |
! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<f32> |
| 14 |
! CHECK: %[[RES:.*]] = fir.call @fir.exp.contract.f32.f32(%[[A]]) {{.*}}: (f32) -> f32 |
| 15 |
! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<f32> |
| 16 |
b = exp(a) |
| 17 |
end subroutine |
| 18 |
|
| 19 |
! CHECK-LABEL: exp_testd |
| 20 |
! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<f64> {{.*}}, %[[BREF:.*]]: !fir.ref<f64> {{.*}}) |
| 21 |
subroutine exp_testd(a, b) |
| 22 |
real(kind=8) :: a, b |
| 23 |
! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<f64> |
| 24 |
! CHECK: %[[RES:.*]] = fir.call @fir.exp.contract.f64.f64(%[[A]]) {{.*}}: (f64) -> f64 |
| 25 |
! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<f64> |
| 26 |
b = exp(a) |
| 27 |
end subroutine |
| 28 |
|
| 29 |
! CHECK-LABEL: exp_testc |
| 30 |
! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<!fir.complex<4>> {{.*}}, %[[BREF:.*]]: !fir.ref<!fir.complex<4>> {{.*}}) |
| 31 |
subroutine exp_testc(a, b) |
| 32 |
complex :: a, b |
| 33 |
! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<!fir.complex<4>> |
| 34 |
! CHECK: %[[RES:.*]] = fir.call @fir.exp.contract.z4.z4(%[[A]]) {{.*}}: (!fir.complex<4>) -> !fir.complex<4> |
| 35 |
! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<!fir.complex<4>> |
| 36 |
b = exp(a) |
| 37 |
end subroutine |
| 38 |
|
| 39 |
! CHECK-LABEL: exp_testcd |
| 40 |
! CHECK-SAME: (%[[AREF:.*]]: !fir.ref<!fir.complex<8>> {{.*}}, %[[BREF:.*]]: !fir.ref<!fir.complex<8>> {{.*}}) |
| 41 |
subroutine exp_testcd(a, b) |
| 42 |
complex(kind=8) :: a, b |
| 43 |
! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref<!fir.complex<8>> |
| 44 |
! CHECK: %[[RES:.*]] = fir.call @fir.exp.contract.z8.z8(%[[A]]) {{.*}}: (!fir.complex<8>) -> !fir.complex<8> |
| 45 |
! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref<!fir.complex<8>> |
| 46 |
b = exp(a) |
| 47 |
end subroutine |
| 48 |
|
| 49 |
! CHECK-LABEL: private @fir.exp.contract.f32.f32 |
| 50 |
! CHECK-SAME: (%[[ARG32_OUTLINE:.*]]: f32) -> f32 |
| 51 |
! CHECK: %[[RESULT32_OUTLINE:.*]] = math.exp %[[ARG32_OUTLINE]] fastmath<contract> : f32 |
| 52 |
! CHECK: return %[[RESULT32_OUTLINE]] : f32 |
| 53 |
|
| 54 |
! CHECK-LABEL: private @fir.exp.contract.f64.f64 |
| 55 |
! CHECK-SAME: (%[[ARG64_OUTLINE:.*]]: f64) -> f64 |
| 56 |
! CHECK: %[[RESULT64_OUTLINE:.*]] = math.exp %[[ARG64_OUTLINE]] fastmath<contract> : f64 |
| 57 |
! CHECK: return %[[RESULT64_OUTLINE]] : f64 |
| 58 |
|
| 59 |
! CMPLX-APPROX-LABEL: private @fir.exp.contract_afn.z4.z4 |
| 60 |
! CMPLX-PRECISE-LABEL: private @fir.exp.contract.z4.z4 |
| 61 |
! CMPLX-MLIR-LABEL: private @fir.exp.contract.z4.z4 |
| 62 |
! CMPLX-SAME: (%[[ARG32_OUTLINE:.*]]: !fir.complex<4>) -> !fir.complex<4> |
| 63 |
! CMPLX-FAST: %[[C:.*]] = fir.convert %[[ARG32_OUTLINE]] : (!fir.complex<4>) -> complex<f32> |
| 64 |
! CMPLX-FAST: %[[E:.*]] = complex.exp %[[C]] fastmath<contract> : complex<f32> |
| 65 |
! CMPLX-FAST: %[[RESULT32_OUTLINE:.*]] = fir.convert %[[E]] : (complex<f32>) -> !fir.complex<4> |
| 66 |
! CMPLX-APPROX: %[[C:.*]] = fir.convert %[[ARG32_OUTLINE]] : (!fir.complex<4>) -> complex<f32> |
| 67 |
! CMPLX-APPROX: %[[E:.*]] = complex.exp %[[C]] fastmath<contract,afn> : complex<f32> |
| 68 |
! CMPLX-APPROX: %[[RESULT32_OUTLINE:.*]] = fir.convert %[[E]] : (complex<f32>) -> !fir.complex<4> |
| 69 |
! CMPLX-PRECISE: %[[RESULT32_OUTLINE:.*]] = fir.call @cexpf(%[[ARG32_OUTLINE]]) fastmath<contract> : (!fir.complex<4>) -> !fir.complex<4> |
| 70 |
! CMPLX: return %[[RESULT32_OUTLINE]] : !fir.complex<4> |
| 71 |
|
| 72 |
! CMPLX-APPROX-LABEL: private @fir.exp.contract_afn.z8.z8 |
| 73 |
! CMPLX-PRECISE-LABEL: private @fir.exp.contract.z8.z8 |
| 74 |
! CMPLX-MLIR-LABEL: private @fir.exp.contract.z8.z8 |
| 75 |
! CMPLX-SAME: (%[[ARG64_OUTLINE:.*]]: !fir.complex<8>) -> !fir.complex<8> |
| 76 |
! CMPLX-FAST: %[[C:.*]] = fir.convert %[[ARG64_OUTLINE]] : (!fir.complex<8>) -> complex<f64> |
| 77 |
! CMPLX-FAST: %[[E:.*]] = complex.exp %[[C]] fastmath<contract> : complex<f64> |
| 78 |
! CMPLX-FAST: %[[RESULT64_OUTLINE:.*]] = fir.convert %[[E]] : (complex<f64>) -> !fir.complex<8> |
| 79 |
! CMPLX-APPROX: %[[C:.*]] = fir.convert %[[ARG64_OUTLINE]] : (!fir.complex<8>) -> complex<f64> |
| 80 |
! CMPLX-APPROX: %[[E:.*]] = complex.exp %[[C]] fastmath<contract,afn> : complex<f64> |
| 81 |
! CMPLX-APPROX: %[[RESULT64_OUTLINE:.*]] = fir.convert %[[E]] : (complex<f64>) -> !fir.complex<8> |
| 82 |
! CMPLX-PRECISE: %[[RESULT64_OUTLINE:.*]] = fir.call @cexp(%[[ARG64_OUTLINE]]) fastmath<contract> : (!fir.complex<8>) -> !fir.complex<8> |
| 83 |
! CMPLX: return %[[RESULT64_OUTLINE]] : !fir.complex<8> |