| 1 |
! RUN: bbc -emit-fir -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CHECK,CMPLX-PRECISE" |
| 2 |
! RUN: bbc --math-runtime=precise -emit-fir -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CMPLX-PRECISE" |
| 3 |
! RUN: %flang_fc1 -emit-fir -mllvm -outline-intrinsics %s -o - | FileCheck %s |
| 4 |
! RUN: %flang_fc1 -fapprox-func -emit-fir -mllvm -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CMPLX-FAST" |
| 5 |
|
| 6 |
! CHECK-LABEL: tan_testr |
| 7 |
subroutine tan_testr(a, b) |
| 8 |
real :: a, b |
| 9 |
! CHECK: fir.call @fir.tan.contract.f32.f32 |
| 10 |
b = tan(a) |
| 11 |
end subroutine |
| 12 |
|
| 13 |
! CHECK-LABEL: tan_testd |
| 14 |
subroutine tan_testd(a, b) |
| 15 |
real(kind=8) :: a, b |
| 16 |
! CHECK: fir.call @fir.tan.contract.f64.f64 |
| 17 |
b = tan(a) |
| 18 |
end subroutine |
| 19 |
|
| 20 |
! CHECK-LABEL: tan_testc |
| 21 |
subroutine tan_testc(z) |
| 22 |
complex :: z |
| 23 |
! CHECK: fir.call @fir.tan.contract.z4.z4 |
| 24 |
z = tan(z) |
| 25 |
end subroutine |
| 26 |
|
| 27 |
! CHECK-LABEL: tan_testcd |
| 28 |
subroutine tan_testcd(z) |
| 29 |
complex(kind=8) :: z |
| 30 |
! CHECK: fir.call @fir.tan.contract.z8.z8 |
| 31 |
z = tan(z) |
| 32 |
end subroutine |
| 33 |
|
| 34 |
! CHECK-LABEL: atan_testr |
| 35 |
subroutine atan_testr(a, b) |
| 36 |
real :: a, b |
| 37 |
! CHECK: fir.call @fir.atan.contract.f32.f32 |
| 38 |
b = atan(a) |
| 39 |
end subroutine |
| 40 |
|
| 41 |
! CHECK-LABEL: atan_testd |
| 42 |
subroutine atan_testd(a, b) |
| 43 |
real(kind=8) :: a, b |
| 44 |
! CHECK: fir.call @fir.atan.contract.f64.f64 |
| 45 |
b = atan(a) |
| 46 |
end subroutine |
| 47 |
|
| 48 |
! CHECK-LABEL: atan_testc |
| 49 |
subroutine atan_testc(z) |
| 50 |
complex :: z |
| 51 |
! CHECK: fir.call @fir.atan.contract.z4.z4 |
| 52 |
z = atan(z) |
| 53 |
end subroutine |
| 54 |
|
| 55 |
! CHECK-LABEL: atan_testcd |
| 56 |
subroutine atan_testcd(z) |
| 57 |
complex(kind=8) :: z |
| 58 |
! CHECK: fir.call @fir.atan.contract.z8.z8 |
| 59 |
z = atan(z) |
| 60 |
end subroutine |
| 61 |
|
| 62 |
! CHECK-LABEL: cos_testr |
| 63 |
subroutine cos_testr(a, b) |
| 64 |
real :: a, b |
| 65 |
! CHECK: fir.call @fir.cos.contract.f32.f32 |
| 66 |
b = cos(a) |
| 67 |
end subroutine |
| 68 |
|
| 69 |
! CHECK-LABEL: cos_testd |
| 70 |
subroutine cos_testd(a, b) |
| 71 |
real(kind=8) :: a, b |
| 72 |
! CHECK: fir.call @fir.cos.contract.f64.f64 |
| 73 |
b = cos(a) |
| 74 |
end subroutine |
| 75 |
|
| 76 |
! CHECK-LABEL: cos_testc |
| 77 |
subroutine cos_testc(z) |
| 78 |
complex :: z |
| 79 |
! CHECK: fir.call @fir.cos.contract.z4.z4 |
| 80 |
z = cos(z) |
| 81 |
end subroutine |
| 82 |
|
| 83 |
! CHECK-LABEL: cos_testcd |
| 84 |
subroutine cos_testcd(z) |
| 85 |
complex(kind=8) :: z |
| 86 |
! CHECK: fir.call @fir.cos.contract.z8.z8 |
| 87 |
z = cos(z) |
| 88 |
end subroutine |
| 89 |
|
| 90 |
! CHECK-LABEL: cosh_testr |
| 91 |
subroutine cosh_testr(a, b) |
| 92 |
real :: a, b |
| 93 |
! CHECK: fir.call @fir.cosh.contract.f32.f32 |
| 94 |
b = cosh(a) |
| 95 |
end subroutine |
| 96 |
|
| 97 |
! CHECK-LABEL: cosh_testd |
| 98 |
subroutine cosh_testd(a, b) |
| 99 |
real(kind=8) :: a, b |
| 100 |
! CHECK: fir.call @fir.cosh.contract.f64.f64 |
| 101 |
b = cosh(a) |
| 102 |
end subroutine |
| 103 |
|
| 104 |
! CHECK-LABEL: cosh_testc |
| 105 |
subroutine cosh_testc(z) |
| 106 |
complex :: z |
| 107 |
! CHECK: fir.call @fir.cosh.contract.z4.z4 |
| 108 |
z = cosh(z) |
| 109 |
end subroutine |
| 110 |
|
| 111 |
! CHECK-LABEL: cosh_testcd |
| 112 |
subroutine cosh_testcd(z) |
| 113 |
complex(kind=8) :: z |
| 114 |
! CHECK: fir.call @fir.cosh.contract.z8.z8 |
| 115 |
z = cosh(z) |
| 116 |
end subroutine |
| 117 |
|
| 118 |
! CHECK-LABEL: sin_testr |
| 119 |
subroutine sin_testr(a, b) |
| 120 |
real :: a, b |
| 121 |
! CHECK: fir.call @fir.sin.contract.f32.f32 |
| 122 |
b = sin(a) |
| 123 |
end subroutine |
| 124 |
|
| 125 |
! CHECK-LABEL: sin_testd |
| 126 |
subroutine sin_testd(a, b) |
| 127 |
real(kind=8) :: a, b |
| 128 |
! CHECK: fir.call @fir.sin.contract.f64.f64 |
| 129 |
b = sin(a) |
| 130 |
end subroutine |
| 131 |
|
| 132 |
! CHECK-LABEL: sin_testc |
| 133 |
subroutine sin_testc(z) |
| 134 |
complex :: z |
| 135 |
! CHECK: fir.call @fir.sin.contract.z4.z4 |
| 136 |
z = sin(z) |
| 137 |
end subroutine |
| 138 |
|
| 139 |
! CHECK-LABEL: sin_testcd |
| 140 |
subroutine sin_testcd(z) |
| 141 |
complex(kind=8) :: z |
| 142 |
! CHECK: fir.call @fir.sin.contract.z8.z8 |
| 143 |
z = sin(z) |
| 144 |
end subroutine |
| 145 |
|
| 146 |
! CHECK-LABEL: sinh_testr |
| 147 |
subroutine sinh_testr(a, b) |
| 148 |
real :: a, b |
| 149 |
! CHECK: fir.call @fir.sinh.contract.f32.f32 |
| 150 |
b = sinh(a) |
| 151 |
end subroutine |
| 152 |
|
| 153 |
! CHECK-LABEL: sinh_testd |
| 154 |
subroutine sinh_testd(a, b) |
| 155 |
real(kind=8) :: a, b |
| 156 |
! CHECK: fir.call @fir.sinh.contract.f64.f64 |
| 157 |
b = sinh(a) |
| 158 |
end subroutine |
| 159 |
|
| 160 |
! CHECK-LABEL: sinh_testc |
| 161 |
subroutine sinh_testc(z) |
| 162 |
complex :: z |
| 163 |
! CHECK: fir.call @fir.sinh.contract.z4.z4 |
| 164 |
z = sinh(z) |
| 165 |
end subroutine |
| 166 |
|
| 167 |
! CHECK-LABEL: sinh_testcd |
| 168 |
subroutine sinh_testcd(z) |
| 169 |
complex(kind=8) :: z |
| 170 |
! CHECK: fir.call @fir.sinh.contract.z8.z8 |
| 171 |
z = sinh(z) |
| 172 |
end subroutine |
| 173 |
|
| 174 |
! CHECK-LABEL: @fir.tan.contract.f32.f32 |
| 175 |
! CHECK: math.tan %{{.*}} : f32 |
| 176 |
|
| 177 |
! CHECK-LABEL: @fir.tan.contract.f64.f64 |
| 178 |
! CHECK: math.tan %{{.*}} : f64 |
| 179 |
|
| 180 |
! CHECK-LABEL: @fir.tan.contract.z4.z4 |
| 181 |
! CMPLX-FAST: complex.tan %{{.*}} : complex<f32> |
| 182 |
! CMPLX-PRECISE: fir.call @ctanf |
| 183 |
|
| 184 |
! CHECK-LABEL: @fir.tan.contract.z8.z8 |
| 185 |
! CMPLX-FAST: complex.tan %{{.*}} : complex<f64> |
| 186 |
! CMPLX-PRECISE: fir.call @ctan |
| 187 |
|
| 188 |
! CHECK-LABEL: @fir.atan.contract.f32.f32 |
| 189 |
! CHECK: math.atan %{{.*}} : f32 |
| 190 |
|
| 191 |
! CHECK-LABEL: @fir.atan.contract.f64.f64 |
| 192 |
! CHECK: math.atan %{{.*}} : f64 |
| 193 |
|
| 194 |
! CHECK-LABEL: @fir.atan.contract.z4.z4 |
| 195 |
! CHECK: fir.call @catanf |
| 196 |
|
| 197 |
! CHECK-LABEL: @fir.atan.contract.z8.z8 |
| 198 |
! CHECK: fir.call @catan |
| 199 |
|
| 200 |
! CHECK-LABEL: @fir.cos.contract.f32.f32 |
| 201 |
! CHECK: math.cos %{{.*}} : f32 |
| 202 |
|
| 203 |
! CHECK-LABEL: @fir.cos.contract.f64.f64 |
| 204 |
! CHECK: math.cos %{{.*}} : f64 |
| 205 |
|
| 206 |
! CHECK-LABEL: @fir.cos.contract.z4.z4 |
| 207 |
! CMPLX-FAST: complex.cos %{{.*}} : complex<f32> |
| 208 |
! CMPLX-PRECISE: fir.call @ccosf |
| 209 |
|
| 210 |
! CHECK-LABEL: @fir.cos.contract.z8.z8 |
| 211 |
! CMPLX-FAST: complex.cos %{{.*}} : complex<f64> |
| 212 |
! CMPLX-PRECISE: fir.call @ccos |
| 213 |
|
| 214 |
! CHECK-LABEL: @fir.cosh.contract.f32.f32 |
| 215 |
! CHECK: fir.call {{.*}}cosh |
| 216 |
|
| 217 |
! CHECK-LABEL: @fir.cosh.contract.f64.f64 |
| 218 |
! CHECK: fir.call {{.*}}cosh |
| 219 |
|
| 220 |
! CHECK-LABEL: @fir.cosh.contract.z4.z4 |
| 221 |
! CHECK: fir.call @ccoshf |
| 222 |
|
| 223 |
! CHECK-LABEL: @fir.cosh.contract.z8.z8 |
| 224 |
! CHECK: fir.call @ccosh |
| 225 |
|
| 226 |
! CHECK-LABEL: @fir.sin.contract.f32.f32 |
| 227 |
! CHECK: math.sin %{{.*}} : f32 |
| 228 |
|
| 229 |
! CHECK-LABEL: @fir.sin.contract.f64.f64 |
| 230 |
! CHECK: math.sin %{{.*}} : f64 |
| 231 |
|
| 232 |
! CHECK-LABEL: @fir.sin.contract.z4.z4 |
| 233 |
! CMPLX-FAST: complex.sin %{{.*}} : complex<f32> |
| 234 |
! CMPLX-PRECISE: fir.call @csinf |
| 235 |
|
| 236 |
! CHECK-LABEL: @fir.sin.contract.z8.z8 |
| 237 |
! CMPLX-FAST: complex.sin %{{.*}} : complex<f64> |
| 238 |
! CMPLX-PRECISE: fir.call @csin |
| 239 |
|
| 240 |
! CHECK-LABEL: @fir.sinh.contract.f32.f32 |
| 241 |
! CHECK: fir.call {{.*}}sinh |
| 242 |
|
| 243 |
! CHECK-LABEL: @fir.sinh.contract.f64.f64 |
| 244 |
! CHECK: fir.call {{.*}}sinh |
| 245 |
|
| 246 |
! CHECK-LABEL: @fir.sinh.contract.z4.z4 |
| 247 |
! CHECK: fir.call @csinhf |
| 248 |
|
| 249 |
! CHECK-LABEL: @fir.sinh.contract.z8.z8 |
| 250 |
! CHECK: fir.call @csinh |