Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / trigonometric-intrinsics.f90
blobe1e690c9ffd5807791d09f35f6f299fea7bd6c55
1 ! RUN: bbc -emit-fir -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CHECK,CMPLX-FAST"
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
5 ! CHECK-LABEL: tan_testr
6 subroutine tan_testr(a, b)
7 real :: a, b
8 ! CHECK: fir.call @fir.tan.f32.f32
9 b = tan(a)
10 end subroutine
12 ! CHECK-LABEL: tan_testd
13 subroutine tan_testd(a, b)
14 real(kind=8) :: a, b
15 ! CHECK: fir.call @fir.tan.f64.f64
16 b = tan(a)
17 end subroutine
19 ! CHECK-LABEL: tan_testc
20 subroutine tan_testc(z)
21 complex :: z
22 ! CHECK: fir.call @fir.tan.z4.z4
23 z = tan(z)
24 end subroutine
26 ! CHECK-LABEL: tan_testcd
27 subroutine tan_testcd(z)
28 complex(kind=8) :: z
29 ! CHECK: fir.call @fir.tan.z8.z8
30 z = tan(z)
31 end subroutine
33 ! CHECK-LABEL: atan_testr
34 subroutine atan_testr(a, b)
35 real :: a, b
36 ! CHECK: fir.call @fir.atan.f32.f32
37 b = atan(a)
38 end subroutine
40 ! CHECK-LABEL: atan_testd
41 subroutine atan_testd(a, b)
42 real(kind=8) :: a, b
43 ! CHECK: fir.call @fir.atan.f64.f64
44 b = atan(a)
45 end subroutine
47 ! CHECK-LABEL: atan_testc
48 subroutine atan_testc(z)
49 complex :: z
50 ! CHECK: fir.call @fir.atan.z4.z4
51 z = atan(z)
52 end subroutine
54 ! CHECK-LABEL: atan_testcd
55 subroutine atan_testcd(z)
56 complex(kind=8) :: z
57 ! CHECK: fir.call @fir.atan.z8.z8
58 z = atan(z)
59 end subroutine
61 ! CHECK-LABEL: cos_testr
62 subroutine cos_testr(a, b)
63 real :: a, b
64 ! CHECK: fir.call @fir.cos.f32.f32
65 b = cos(a)
66 end subroutine
68 ! CHECK-LABEL: cos_testd
69 subroutine cos_testd(a, b)
70 real(kind=8) :: a, b
71 ! CHECK: fir.call @fir.cos.f64.f64
72 b = cos(a)
73 end subroutine
75 ! CHECK-LABEL: cos_testc
76 subroutine cos_testc(z)
77 complex :: z
78 ! CHECK: fir.call @fir.cos.z4.z4
79 z = cos(z)
80 end subroutine
82 ! CHECK-LABEL: cos_testcd
83 subroutine cos_testcd(z)
84 complex(kind=8) :: z
85 ! CHECK: fir.call @fir.cos.z8.z8
86 z = cos(z)
87 end subroutine
89 ! CHECK-LABEL: cosh_testr
90 subroutine cosh_testr(a, b)
91 real :: a, b
92 ! CHECK: fir.call @fir.cosh.f32.f32
93 b = cosh(a)
94 end subroutine
96 ! CHECK-LABEL: cosh_testd
97 subroutine cosh_testd(a, b)
98 real(kind=8) :: a, b
99 ! CHECK: fir.call @fir.cosh.f64.f64
100 b = cosh(a)
101 end subroutine
103 ! CHECK-LABEL: cosh_testc
104 subroutine cosh_testc(z)
105 complex :: z
106 ! CHECK: fir.call @fir.cosh.z4.z4
107 z = cosh(z)
108 end subroutine
110 ! CHECK-LABEL: cosh_testcd
111 subroutine cosh_testcd(z)
112 complex(kind=8) :: z
113 ! CHECK: fir.call @fir.cosh.z8.z8
114 z = cosh(z)
115 end subroutine
117 ! CHECK-LABEL: sin_testr
118 subroutine sin_testr(a, b)
119 real :: a, b
120 ! CHECK: fir.call @fir.sin.f32.f32
121 b = sin(a)
122 end subroutine
124 ! CHECK-LABEL: sin_testd
125 subroutine sin_testd(a, b)
126 real(kind=8) :: a, b
127 ! CHECK: fir.call @fir.sin.f64.f64
128 b = sin(a)
129 end subroutine
131 ! CHECK-LABEL: sin_testc
132 subroutine sin_testc(z)
133 complex :: z
134 ! CHECK: fir.call @fir.sin.z4.z4
135 z = sin(z)
136 end subroutine
138 ! CHECK-LABEL: sin_testcd
139 subroutine sin_testcd(z)
140 complex(kind=8) :: z
141 ! CHECK: fir.call @fir.sin.z8.z8
142 z = sin(z)
143 end subroutine
145 ! CHECK-LABEL: sinh_testr
146 subroutine sinh_testr(a, b)
147 real :: a, b
148 ! CHECK: fir.call @fir.sinh.f32.f32
149 b = sinh(a)
150 end subroutine
152 ! CHECK-LABEL: sinh_testd
153 subroutine sinh_testd(a, b)
154 real(kind=8) :: a, b
155 ! CHECK: fir.call @fir.sinh.f64.f64
156 b = sinh(a)
157 end subroutine
159 ! CHECK-LABEL: sinh_testc
160 subroutine sinh_testc(z)
161 complex :: z
162 ! CHECK: fir.call @fir.sinh.z4.z4
163 z = sinh(z)
164 end subroutine
166 ! CHECK-LABEL: sinh_testcd
167 subroutine sinh_testcd(z)
168 complex(kind=8) :: z
169 ! CHECK: fir.call @fir.sinh.z8.z8
170 z = sinh(z)
171 end subroutine
173 ! CHECK-LABEL: @fir.tan.f32.f32
174 ! CHECK: math.tan %{{.*}} : f32
176 ! CHECK-LABEL: @fir.tan.f64.f64
177 ! CHECK: math.tan %{{.*}} : f64
179 ! CHECK-LABEL: @fir.tan.z4.z4
180 ! CMPLX-FAST: complex.tan %{{.*}} : complex<f32>
181 ! CMPLX-PRECISE: fir.call @ctanf
183 ! CHECK-LABEL: @fir.tan.z8.z8
184 ! CMPLX-FAST: complex.tan %{{.*}} : complex<f64>
185 ! CMPLX-PRECISE: fir.call @ctan
187 ! CHECK-LABEL: @fir.atan.f32.f32
188 ! CHECK: math.atan %{{.*}} : f32
190 ! CHECK-LABEL: @fir.atan.f64.f64
191 ! CHECK: math.atan %{{.*}} : f64
193 ! CHECK-LABEL: @fir.atan.z4.z4
194 ! CHECK: fir.call @catanf
196 ! CHECK-LABEL: @fir.atan.z8.z8
197 ! CHECK: fir.call @catan
199 ! CHECK-LABEL: @fir.cos.f32.f32
200 ! CHECK: math.cos %{{.*}} : f32
202 ! CHECK-LABEL: @fir.cos.f64.f64
203 ! CHECK: math.cos %{{.*}} : f64
205 ! CHECK-LABEL: @fir.cos.z4.z4
206 ! CMPLX-FAST: complex.cos %{{.*}} : complex<f32>
207 ! CMPLX-PRECISE: fir.call @ccosf
209 ! CHECK-LABEL: @fir.cos.z8.z8
210 ! CMPLX-FAST: complex.cos %{{.*}} : complex<f64>
211 ! CMPLX-PRECISE: fir.call @ccos
213 ! CHECK-LABEL: @fir.cosh.f32.f32
214 ! CHECK: fir.call {{.*}}cosh
216 ! CHECK-LABEL: @fir.cosh.f64.f64
217 ! CHECK: fir.call {{.*}}cosh
219 ! CHECK-LABEL: @fir.cosh.z4.z4
220 ! CHECK: fir.call @ccoshf
222 ! CHECK-LABEL: @fir.cosh.z8.z8
223 ! CHECK: fir.call @ccosh
225 ! CHECK-LABEL: @fir.sin.f32.f32
226 ! CHECK: math.sin %{{.*}} : f32
228 ! CHECK-LABEL: @fir.sin.f64.f64
229 ! CHECK: math.sin %{{.*}} : f64
231 ! CHECK-LABEL: @fir.sin.z4.z4
232 ! CMPLX-FAST: complex.sin %{{.*}} : complex<f32>
233 ! CMPLX-PRECISE: fir.call @csinf
235 ! CHECK-LABEL: @fir.sin.z8.z8
236 ! CMPLX-FAST: complex.sin %{{.*}} : complex<f64>
237 ! CMPLX-PRECISE: fir.call @csin
239 ! CHECK-LABEL: @fir.sinh.f32.f32
240 ! CHECK: fir.call {{.*}}sinh
242 ! CHECK-LABEL: @fir.sinh.f64.f64
243 ! CHECK: fir.call {{.*}}sinh
245 ! CHECK-LABEL: @fir.sinh.z4.z4
246 ! CHECK: fir.call @csinhf
248 ! CHECK-LABEL: @fir.sinh.z8.z8
249 ! CHECK: fir.call @csinh