blob: d1edd4ef48dc30b284cc5f45a4c7a85525a35886 [file] [log] [blame]
David Truby3681a7d2023-07-14 16:02:441! RUN: bbc -emit-fir -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CHECK,CMPLX-PRECISE"
David Truby000de662022-10-24 12:42:292! RUN: bbc --math-runtime=precise -emit-fir -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CMPLX-PRECISE"
Slava Zakharin9f356572022-06-22 21:41:023! RUN: %flang_fc1 -emit-fir -mllvm -outline-intrinsics %s -o - | FileCheck %s
David Truby3681a7d2023-07-14 16:02:444! RUN: %flang_fc1 -fapprox-func -emit-fir -mllvm -outline-intrinsics %s -o - | FileCheck %s --check-prefixes="CMPLX-FAST"
Kiran Chandramohan3d948512022-03-23 14:39:115
David Truby8bd54402022-09-26 13:30:206! CHECK-LABEL: tan_testr
7subroutine tan_testr(a, b)
8 real :: a, b
David Trubyf52c64b2023-07-06 14:32:309! CHECK: fir.call @fir.tan.contract.f32.f32
David Truby8bd54402022-09-26 13:30:2010 b = tan(a)
11end subroutine
12
13! CHECK-LABEL: tan_testd
14subroutine tan_testd(a, b)
15 real(kind=8) :: a, b
David Trubyf52c64b2023-07-06 14:32:3016! CHECK: fir.call @fir.tan.contract.f64.f64
David Truby8bd54402022-09-26 13:30:2017 b = tan(a)
18end subroutine
19
20! CHECK-LABEL: tan_testc
21subroutine tan_testc(z)
22 complex :: z
jeanPerierc4204c02024-10-03 15:10:5723! CHECK: fir.call @fir.tan.contract.z32.z32
David Truby8bd54402022-09-26 13:30:2024 z = tan(z)
25end subroutine
26
27! CHECK-LABEL: tan_testcd
28subroutine tan_testcd(z)
29 complex(kind=8) :: z
jeanPerierc4204c02024-10-03 15:10:5730! CHECK: fir.call @fir.tan.contract.z64.z64
David Truby8bd54402022-09-26 13:30:2031 z = tan(z)
32end subroutine
33
Kiran Chandramohan3d948512022-03-23 14:39:1134! CHECK-LABEL: atan_testr
35subroutine atan_testr(a, b)
36 real :: a, b
David Trubyf52c64b2023-07-06 14:32:3037! CHECK: fir.call @fir.atan.contract.f32.f32
Kiran Chandramohan3d948512022-03-23 14:39:1138 b = atan(a)
39end subroutine
40
41! CHECK-LABEL: atan_testd
42subroutine atan_testd(a, b)
43 real(kind=8) :: a, b
David Trubyf52c64b2023-07-06 14:32:3044! CHECK: fir.call @fir.atan.contract.f64.f64
Kiran Chandramohan3d948512022-03-23 14:39:1145 b = atan(a)
46end subroutine
47
48! CHECK-LABEL: atan_testc
49subroutine atan_testc(z)
50 complex :: z
jeanPerierc4204c02024-10-03 15:10:5751! CHECK: fir.call @fir.atan.contract.z32.z32
Kiran Chandramohan3d948512022-03-23 14:39:1152 z = atan(z)
53end subroutine
54
55! CHECK-LABEL: atan_testcd
56subroutine atan_testcd(z)
57 complex(kind=8) :: z
jeanPerierc4204c02024-10-03 15:10:5758! CHECK: fir.call @fir.atan.contract.z64.z64
Kiran Chandramohan3d948512022-03-23 14:39:1159 z = atan(z)
60end subroutine
61
Kiran Chandramohan7a9891c2022-03-23 15:20:2262! CHECK-LABEL: cos_testr
63subroutine cos_testr(a, b)
64 real :: a, b
David Trubyf52c64b2023-07-06 14:32:3065! CHECK: fir.call @fir.cos.contract.f32.f32
Kiran Chandramohan7a9891c2022-03-23 15:20:2266 b = cos(a)
67end subroutine
68
69! CHECK-LABEL: cos_testd
70subroutine cos_testd(a, b)
71 real(kind=8) :: a, b
David Trubyf52c64b2023-07-06 14:32:3072! CHECK: fir.call @fir.cos.contract.f64.f64
Kiran Chandramohan7a9891c2022-03-23 15:20:2273 b = cos(a)
74end subroutine
75
76! CHECK-LABEL: cos_testc
77subroutine cos_testc(z)
78 complex :: z
jeanPerierc4204c02024-10-03 15:10:5779! CHECK: fir.call @fir.cos.contract.z32.z32
Kiran Chandramohan7a9891c2022-03-23 15:20:2280 z = cos(z)
81end subroutine
82
83! CHECK-LABEL: cos_testcd
84subroutine cos_testcd(z)
85 complex(kind=8) :: z
jeanPerierc4204c02024-10-03 15:10:5786! CHECK: fir.call @fir.cos.contract.z64.z64
Kiran Chandramohan7a9891c2022-03-23 15:20:2287 z = cos(z)
88end subroutine
89
Jan Leyonbergf61d93f2025-01-23 15:23:5090! CHECK-LABEL: acos_testr
91subroutine acos_testr(a, b)
92 real :: a, b
93! CHECK: fir.call @fir.acos.contract.f32.f32
94 b = acos(a)
95end subroutine
96
97! CHECK-LABEL: acos_testd
98subroutine acos_testd(a, b)
99 real(kind=8) :: a, b
100! CHECK: fir.call @fir.acos.contract.f64.f64
101 b = acos(a)
102end subroutine
103
104! CHECK-LABEL: acos_testc
105subroutine acos_testc(z)
106 complex :: z
107! CHECK: fir.call @fir.acos.contract.z32.z32
108 z = acos(z)
109end subroutine
110
111! CHECK-LABEL: acos_testcd
112subroutine acos_testcd(z)
113 complex(kind=8) :: z
114! CHECK: fir.call @fir.acos.contract.z64.z64
115 z = acos(z)
116end subroutine
117
Kiran Chandramohan3d948512022-03-23 14:39:11118! CHECK-LABEL: cosh_testr
119subroutine cosh_testr(a, b)
120 real :: a, b
David Trubyf52c64b2023-07-06 14:32:30121! CHECK: fir.call @fir.cosh.contract.f32.f32
Kiran Chandramohan3d948512022-03-23 14:39:11122 b = cosh(a)
123end subroutine
124
125! CHECK-LABEL: cosh_testd
126subroutine cosh_testd(a, b)
127 real(kind=8) :: a, b
David Trubyf52c64b2023-07-06 14:32:30128! CHECK: fir.call @fir.cosh.contract.f64.f64
Kiran Chandramohan3d948512022-03-23 14:39:11129 b = cosh(a)
130end subroutine
131
132! CHECK-LABEL: cosh_testc
133subroutine cosh_testc(z)
134 complex :: z
jeanPerierc4204c02024-10-03 15:10:57135! CHECK: fir.call @fir.cosh.contract.z32.z32
Kiran Chandramohan3d948512022-03-23 14:39:11136 z = cosh(z)
137end subroutine
138
139! CHECK-LABEL: cosh_testcd
140subroutine cosh_testcd(z)
141 complex(kind=8) :: z
jeanPerierc4204c02024-10-03 15:10:57142! CHECK: fir.call @fir.cosh.contract.z64.z64
Kiran Chandramohan3d948512022-03-23 14:39:11143 z = cosh(z)
144end subroutine
145
Kiran Chandramohan7a9891c2022-03-23 15:20:22146! CHECK-LABEL: sin_testr
147subroutine sin_testr(a, b)
148 real :: a, b
David Trubyf52c64b2023-07-06 14:32:30149! CHECK: fir.call @fir.sin.contract.f32.f32
Kiran Chandramohan7a9891c2022-03-23 15:20:22150 b = sin(a)
151end subroutine
152
153! CHECK-LABEL: sin_testd
154subroutine sin_testd(a, b)
155 real(kind=8) :: a, b
David Trubyf52c64b2023-07-06 14:32:30156! CHECK: fir.call @fir.sin.contract.f64.f64
Kiran Chandramohan7a9891c2022-03-23 15:20:22157 b = sin(a)
158end subroutine
159
160! CHECK-LABEL: sin_testc
161subroutine sin_testc(z)
162 complex :: z
jeanPerierc4204c02024-10-03 15:10:57163! CHECK: fir.call @fir.sin.contract.z32.z32
Kiran Chandramohan7a9891c2022-03-23 15:20:22164 z = sin(z)
165end subroutine
166
167! CHECK-LABEL: sin_testcd
168subroutine sin_testcd(z)
169 complex(kind=8) :: z
jeanPerierc4204c02024-10-03 15:10:57170! CHECK: fir.call @fir.sin.contract.z64.z64
Kiran Chandramohan7a9891c2022-03-23 15:20:22171 z = sin(z)
172end subroutine
173
Kiran Chandramohan3d948512022-03-23 14:39:11174! CHECK-LABEL: sinh_testr
175subroutine sinh_testr(a, b)
176 real :: a, b
David Trubyf52c64b2023-07-06 14:32:30177! CHECK: fir.call @fir.sinh.contract.f32.f32
Kiran Chandramohan3d948512022-03-23 14:39:11178 b = sinh(a)
179end subroutine
180
181! CHECK-LABEL: sinh_testd
182subroutine sinh_testd(a, b)
183 real(kind=8) :: a, b
David Trubyf52c64b2023-07-06 14:32:30184! CHECK: fir.call @fir.sinh.contract.f64.f64
Kiran Chandramohan3d948512022-03-23 14:39:11185 b = sinh(a)
186end subroutine
187
188! CHECK-LABEL: sinh_testc
189subroutine sinh_testc(z)
190 complex :: z
jeanPerierc4204c02024-10-03 15:10:57191! CHECK: fir.call @fir.sinh.contract.z32.z32
Kiran Chandramohan3d948512022-03-23 14:39:11192 z = sinh(z)
193end subroutine
194
195! CHECK-LABEL: sinh_testcd
196subroutine sinh_testcd(z)
197 complex(kind=8) :: z
jeanPerierc4204c02024-10-03 15:10:57198! CHECK: fir.call @fir.sinh.contract.z64.z64
Kiran Chandramohan3d948512022-03-23 14:39:11199 z = sinh(z)
200end subroutine
201
David Trubyf52c64b2023-07-06 14:32:30202! CHECK-LABEL: @fir.tan.contract.f32.f32
David Truby8bd54402022-09-26 13:30:20203! CHECK: math.tan %{{.*}} : f32
204
David Trubyf52c64b2023-07-06 14:32:30205! CHECK-LABEL: @fir.tan.contract.f64.f64
David Truby8bd54402022-09-26 13:30:20206! CHECK: math.tan %{{.*}} : f64
207
jeanPerierc4204c02024-10-03 15:10:57208! CHECK-LABEL: @fir.tan.contract.z32.z32
David Truby000de662022-10-24 12:42:29209! CMPLX-FAST: complex.tan %{{.*}} : complex<f32>
210! CMPLX-PRECISE: fir.call @ctanf
David Truby8bd54402022-09-26 13:30:20211
jeanPerierc4204c02024-10-03 15:10:57212! CHECK-LABEL: @fir.tan.contract.z64.z64
David Truby000de662022-10-24 12:42:29213! CMPLX-FAST: complex.tan %{{.*}} : complex<f64>
214! CMPLX-PRECISE: fir.call @ctan
David Truby8bd54402022-09-26 13:30:20215
David Trubyf52c64b2023-07-06 14:32:30216! CHECK-LABEL: @fir.atan.contract.f32.f32
Slava Zakharinf5759ad2022-07-19 22:35:56217! CHECK: math.atan %{{.*}} : f32
Kiran Chandramohan3d948512022-03-23 14:39:11218
David Trubyf52c64b2023-07-06 14:32:30219! CHECK-LABEL: @fir.atan.contract.f64.f64
Slava Zakharinf5759ad2022-07-19 22:35:56220! CHECK: math.atan %{{.*}} : f64
Kiran Chandramohan3d948512022-03-23 14:39:11221
jeanPerierc4204c02024-10-03 15:10:57222! CHECK-LABEL: @fir.atan.contract.z32.z32
David Truby8bd54402022-09-26 13:30:20223! CHECK: fir.call @catanf
Kiran Chandramohan3d948512022-03-23 14:39:11224
jeanPerierc4204c02024-10-03 15:10:57225! CHECK-LABEL: @fir.atan.contract.z64.z64
David Truby8bd54402022-09-26 13:30:20226! CHECK: fir.call @catan
Kiran Chandramohan3d948512022-03-23 14:39:11227
David Trubyf52c64b2023-07-06 14:32:30228! CHECK-LABEL: @fir.cos.contract.f32.f32
Slava Zakharinf5759ad2022-07-19 22:35:56229! CHECK: math.cos %{{.*}} : f32
Kiran Chandramohan7a9891c2022-03-23 15:20:22230
David Trubyf52c64b2023-07-06 14:32:30231! CHECK-LABEL: @fir.cos.contract.f64.f64
Slava Zakharinf5759ad2022-07-19 22:35:56232! CHECK: math.cos %{{.*}} : f64
Kiran Chandramohan7a9891c2022-03-23 15:20:22233
jeanPerierc4204c02024-10-03 15:10:57234! CHECK-LABEL: @fir.cos.contract.z32.z32
David Truby000de662022-10-24 12:42:29235! CMPLX-FAST: complex.cos %{{.*}} : complex<f32>
236! CMPLX-PRECISE: fir.call @ccosf
Kiran Chandramohan7a9891c2022-03-23 15:20:22237
jeanPerierc4204c02024-10-03 15:10:57238! CHECK-LABEL: @fir.cos.contract.z64.z64
David Truby000de662022-10-24 12:42:29239! CMPLX-FAST: complex.cos %{{.*}} : complex<f64>
240! CMPLX-PRECISE: fir.call @ccos
Kiran Chandramohan7a9891c2022-03-23 15:20:22241
Jan Leyonbergf61d93f2025-01-23 15:23:50242! CHECK-LABEL: @fir.acos.contract.f32.f32
243! CHECK: math.acos {{.*}} : f32
244
245! CHECK-LABEL: @fir.acos.contract.f64.f64
246! CHECK: math.acos {{.*}} : f64
247
248! CHECK-LABEL: @fir.acos.contract.z32.z32
249! CHECK: fir.call @cacosf
250
251! CHECK-LABEL: @fir.acos.contract.z64.z64
252! CHECK: fir.call @cacos
253
David Trubyf52c64b2023-07-06 14:32:30254! CHECK-LABEL: @fir.cosh.contract.f32.f32
Jan Leyonberg2f7807e2025-01-14 15:52:14255! CHECK: math.cosh {{.*}} : f32
Kiran Chandramohan3d948512022-03-23 14:39:11256
David Trubyf52c64b2023-07-06 14:32:30257! CHECK-LABEL: @fir.cosh.contract.f64.f64
Jan Leyonberg2f7807e2025-01-14 15:52:14258! CHECK: math.cosh {{.*}} : f64
Kiran Chandramohan3d948512022-03-23 14:39:11259
jeanPerierc4204c02024-10-03 15:10:57260! CHECK-LABEL: @fir.cosh.contract.z32.z32
David Truby8bd54402022-09-26 13:30:20261! CHECK: fir.call @ccoshf
Kiran Chandramohan3d948512022-03-23 14:39:11262
jeanPerierc4204c02024-10-03 15:10:57263! CHECK-LABEL: @fir.cosh.contract.z64.z64
David Truby8bd54402022-09-26 13:30:20264! CHECK: fir.call @ccosh
Kiran Chandramohan3d948512022-03-23 14:39:11265
David Trubyf52c64b2023-07-06 14:32:30266! CHECK-LABEL: @fir.sin.contract.f32.f32
Slava Zakharinf5759ad2022-07-19 22:35:56267! CHECK: math.sin %{{.*}} : f32
Kiran Chandramohan7a9891c2022-03-23 15:20:22268
David Trubyf52c64b2023-07-06 14:32:30269! CHECK-LABEL: @fir.sin.contract.f64.f64
Slava Zakharinf5759ad2022-07-19 22:35:56270! CHECK: math.sin %{{.*}} : f64
Kiran Chandramohan7a9891c2022-03-23 15:20:22271
jeanPerierc4204c02024-10-03 15:10:57272! CHECK-LABEL: @fir.sin.contract.z32.z32
David Truby000de662022-10-24 12:42:29273! CMPLX-FAST: complex.sin %{{.*}} : complex<f32>
274! CMPLX-PRECISE: fir.call @csinf
Kiran Chandramohan7a9891c2022-03-23 15:20:22275
jeanPerierc4204c02024-10-03 15:10:57276! CHECK-LABEL: @fir.sin.contract.z64.z64
David Truby000de662022-10-24 12:42:29277! CMPLX-FAST: complex.sin %{{.*}} : complex<f64>
278! CMPLX-PRECISE: fir.call @csin
Kiran Chandramohan7a9891c2022-03-23 15:20:22279
David Trubyf52c64b2023-07-06 14:32:30280! CHECK-LABEL: @fir.sinh.contract.f32.f32
Kiran Chandramohan3d948512022-03-23 14:39:11281! CHECK: fir.call {{.*}}sinh
282
David Trubyf52c64b2023-07-06 14:32:30283! CHECK-LABEL: @fir.sinh.contract.f64.f64
Kiran Chandramohan3d948512022-03-23 14:39:11284! CHECK: fir.call {{.*}}sinh
285
jeanPerierc4204c02024-10-03 15:10:57286! CHECK-LABEL: @fir.sinh.contract.z32.z32
David Truby8bd54402022-09-26 13:30:20287! CHECK: fir.call @csinhf
Kiran Chandramohan3d948512022-03-23 14:39:11288
jeanPerierc4204c02024-10-03 15:10:57289! CHECK-LABEL: @fir.sinh.contract.z64.z64
David Truby8bd54402022-09-26 13:30:20290! CHECK: fir.call @csinh