llvm.org GIT mirror llvm / d15c581
Move win32 SimplifyLibcall test under Transforms git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154967 91177308-0d34-0410-b5e6-96231b3b80d8 Joe Groff 7 years ago
2 changed file(s) with 275 addition(s) and 275 deletion(s). Raw diff Collapse all Expand all
+0
-275
test/CodeGen/X86/win_math_simplify_libcall.ll less more
None ; RUN: opt -O2 -S -mtriple=i386-pc-win32 < %s | FileCheck %s -check-prefix=WIN32
1 ; RUN: opt -O2 -S -mtriple=x86_64-pc-win32 < %s | FileCheck %s -check-prefix=WIN64
2 ; RUN: opt -O2 -S -mtriple=i386-pc-mingw32 < %s | FileCheck %s -check-prefix=MINGW32
3 ; RUN: opt -O2 -S -mtriple=x86_64-pc-mingw32 < %s | FileCheck %s -check-prefix=MINGW64
4
5 ; x86 win32 msvcrt does not provide entry points for single-precision libm.
6 ; x86-64 win32 msvcrt does (except for fabsf)
7 ; msvcrt does not provide C99 math, but mingw32 does.
8
9 declare double @acos(double %x)
10 define float @float_acos(float %x) nounwind readnone {
11 ; WIN32: @float_acos
12 ; WIN32-NOT: float @acosf
13 ; WIN32: double @acos
14 %1 = fpext float %x to double
15 %2 = call double @acos(double %1)
16 %3 = fptrunc double %2 to float
17 ret float %3
18 }
19
20 declare double @asin(double %x)
21 define float @float_asin(float %x) nounwind readnone {
22 ; WIN32: @float_asin
23 ; WIN32-NOT: float @asinf
24 ; WIN32: double @asin
25 %1 = fpext float %x to double
26 %2 = call double @asin(double %1)
27 %3 = fptrunc double %2 to float
28 ret float %3
29 }
30
31 declare double @atan(double %x)
32 define float @float_atan(float %x) nounwind readnone {
33 ; WIN32: @float_atan
34 ; WIN32-NOT: float @atanf
35 ; WIN32: double @atan
36 %1 = fpext float %x to double
37 %2 = call double @atan(double %1)
38 %3 = fptrunc double %2 to float
39 ret float %3
40 }
41
42 declare double @atan2(double %x, double %y)
43 define float @float_atan2(float %x, float %y) nounwind readnone {
44 ; WIN32: @float_atan2
45 ; WIN32-NOT: float @atan2f
46 ; WIN32: double @atan2
47 %1 = fpext float %x to double
48 %2 = fpext float %y to double
49 %3 = call double @atan2(double %1, double %2)
50 %4 = fptrunc double %3 to float
51 ret float %4
52 }
53
54 declare double @ceil(double %x)
55 define float @float_ceil(float %x) nounwind readnone {
56 ; WIN32: @float_ceil
57 ; WIN32-NOT: float @ceilf
58 ; WIN32: double @ceil
59 ; WIN64: @float_ceil
60 ; WIN64: float @ceilf
61 ; WIN64-NOT: double @ceil
62 ; MINGW32: @float_ceil
63 ; MINGW32: float @ceilf
64 ; MINGW32-NOT: double @ceil
65 ; MINGW64: @float_ceil
66 ; MINGW64: float @ceilf
67 ; MINGW64-NOT: double @ceil
68 %1 = fpext float %x to double
69 %2 = call double @ceil(double %1)
70 %3 = fptrunc double %2 to float
71 ret float %3
72 }
73
74 declare double @_copysign(double %x)
75 define float @float_copysign(float %x) nounwind readnone {
76 ; WIN32: @float_copysign
77 ; WIN32-NOT: float @copysignf
78 ; WIN32-NOT: float @_copysignf
79 ; WIN32: double @_copysign
80 %1 = fpext float %x to double
81 %2 = call double @_copysign(double %1)
82 %3 = fptrunc double %2 to float
83 ret float %3
84 }
85
86 declare double @cos(double %x)
87 define float @float_cos(float %x) nounwind readnone {
88 ; WIN32: @float_cos
89 ; WIN32-NOT: float @cosf
90 ; WIN32: double @cos
91 %1 = fpext float %x to double
92 %2 = call double @cos(double %1)
93 %3 = fptrunc double %2 to float
94 ret float %3
95 }
96
97 declare double @cosh(double %x)
98 define float @float_cosh(float %x) nounwind readnone {
99 ; WIN32: @float_cosh
100 ; WIN32-NOT: float @coshf
101 ; WIN32: double @cosh
102 %1 = fpext float %x to double
103 %2 = call double @cosh(double %1)
104 %3 = fptrunc double %2 to float
105 ret float %3
106 }
107
108 declare double @exp(double %x, double %y)
109 define float @float_exp(float %x, float %y) nounwind readnone {
110 ; WIN32: @float_exp
111 ; WIN32-NOT: float @expf
112 ; WIN32: double @exp
113 %1 = fpext float %x to double
114 %2 = fpext float %y to double
115 %3 = call double @exp(double %1, double %2)
116 %4 = fptrunc double %3 to float
117 ret float %4
118 }
119
120 declare double @fabs(double %x, double %y)
121 define float @float_fabs(float %x, float %y) nounwind readnone {
122 ; WIN32: @float_fabs
123 ; WIN32-NOT: float @fabsf
124 ; WIN32: double @fabs
125 ; WIN64: @float_fabs
126 ; WIN64-NOT: float @fabsf
127 ; WIN64: double @fabs
128 %1 = fpext float %x to double
129 %2 = fpext float %y to double
130 %3 = call double @fabs(double %1, double %2)
131 %4 = fptrunc double %3 to float
132 ret float %4
133 }
134
135 declare double @floor(double %x)
136 define float @float_floor(float %x) nounwind readnone {
137 ; WIN32: @float_floor
138 ; WIN32-NOT: float @floorf
139 ; WIN32: double @floor
140 ; WIN64: @float_floor
141 ; WIN64: float @floorf
142 ; WIN64-NOT: double @floor
143 ; MINGW32: @float_floor
144 ; MINGW32: float @floorf
145 ; MINGW32-NOT: double @floor
146 ; MINGW64: @float_floor
147 ; MINGW64: float @floorf
148 ; MINGW64-NOT: double @floor
149 %1 = fpext float %x to double
150 %2 = call double @floor(double %1)
151 %3 = fptrunc double %2 to float
152 ret float %3
153 }
154
155 declare double @fmod(double %x, double %y)
156 define float @float_fmod(float %x, float %y) nounwind readnone {
157 ; WIN32: @float_fmod
158 ; WIN32-NOT: float @fmodf
159 ; WIN32: double @fmod
160 %1 = fpext float %x to double
161 %2 = fpext float %y to double
162 %3 = call double @fmod(double %1, double %2)
163 %4 = fptrunc double %3 to float
164 ret float %4
165 }
166
167 declare double @log(double %x)
168 define float @float_log(float %x) nounwind readnone {
169 ; WIN32: @float_log
170 ; WIN32-NOT: float @logf
171 ; WIN32: double @log
172 %1 = fpext float %x to double
173 %2 = call double @log(double %1)
174 %3 = fptrunc double %2 to float
175 ret float %3
176 }
177
178 declare double @pow(double %x, double %y)
179 define float @float_pow(float %x, float %y) nounwind readnone {
180 ; WIN32: @float_pow
181 ; WIN32-NOT: float @powf
182 ; WIN32: double @pow
183 %1 = fpext float %x to double
184 %2 = fpext float %y to double
185 %3 = call double @pow(double %1, double %2)
186 %4 = fptrunc double %3 to float
187 ret float %4
188 }
189
190 declare double @sin(double %x)
191 define float @float_sin(float %x) nounwind readnone {
192 ; WIN32: @float_sin
193 ; WIN32-NOT: float @sinf
194 ; WIN32: double @sin
195 %1 = fpext float %x to double
196 %2 = call double @sin(double %1)
197 %3 = fptrunc double %2 to float
198 ret float %3
199 }
200
201 declare double @sinh(double %x)
202 define float @float_sinh(float %x) nounwind readnone {
203 ; WIN32: @float_sinh
204 ; WIN32-NOT: float @sinhf
205 ; WIN32: double @sinh
206 %1 = fpext float %x to double
207 %2 = call double @sinh(double %1)
208 %3 = fptrunc double %2 to float
209 ret float %3
210 }
211
212 declare double @sqrt(double %x)
213 define float @float_sqrt(float %x) nounwind readnone {
214 ; WIN32: @float_sqrt
215 ; WIN32-NOT: float @sqrtf
216 ; WIN32: double @sqrt
217 ; WIN64: @float_sqrt
218 ; WIN64: float @sqrtf
219 ; WIN64-NOT: double @sqrt
220 ; MINGW32: @float_sqrt
221 ; MINGW32: float @sqrtf
222 ; MINGW32-NOT: double @sqrt
223 ; MINGW64: @float_sqrt
224 ; MINGW64: float @sqrtf
225 ; MINGW64-NOT: double @sqrt
226 %1 = fpext float %x to double
227 %2 = call double @sqrt(double %1)
228 %3 = fptrunc double %2 to float
229 ret float %3
230 }
231
232 declare double @tan(double %x)
233 define float @float_tan(float %x) nounwind readnone {
234 ; WIN32: @float_tan
235 ; WIN32-NOT: float @tanf
236 ; WIN32: double @tan
237 %1 = fpext float %x to double
238 %2 = call double @tan(double %1)
239 %3 = fptrunc double %2 to float
240 ret float %3
241 }
242
243 declare double @tanh(double %x)
244 define float @float_tanh(float %x) nounwind readnone {
245 ; WIN32: @float_tanh
246 ; WIN32-NOT: float @tanhf
247 ; WIN32: double @tanh
248 %1 = fpext float %x to double
249 %2 = call double @tanh(double %1)
250 %3 = fptrunc double %2 to float
251 ret float %3
252 }
253
254 ; win32 does not have round; mingw32 does
255 declare double @round(double %x)
256 define float @float_round(float %x) nounwind readnone {
257 ; WIN32: @float_round
258 ; WIN32-NOT: float @roundf
259 ; WIN32: double @round
260 ; WIN64: @float_round
261 ; WIN64-NOT: float @roundf
262 ; WIN64: double @round
263 ; MINGW32: @float_round
264 ; MINGW32: float @roundf
265 ; MINGW32-NOT: double @round
266 ; MINGW64: @float_round
267 ; MINGW64: float @roundf
268 ; MINGW64-NOT: double @round
269 %1 = fpext float %x to double
270 %2 = call double @round(double %1)
271 %3 = fptrunc double %2 to float
272 ret float %3
273 }
274
0 ; RUN: opt -O2 -S -mtriple=i386-pc-win32 < %s | FileCheck %s -check-prefix=WIN32
1 ; RUN: opt -O2 -S -mtriple=x86_64-pc-win32 < %s | FileCheck %s -check-prefix=WIN64
2 ; RUN: opt -O2 -S -mtriple=i386-pc-mingw32 < %s | FileCheck %s -check-prefix=MINGW32
3 ; RUN: opt -O2 -S -mtriple=x86_64-pc-mingw32 < %s | FileCheck %s -check-prefix=MINGW64
4
5 ; x86 win32 msvcrt does not provide entry points for single-precision libm.
6 ; x86-64 win32 msvcrt does (except for fabsf)
7 ; msvcrt does not provide C99 math, but mingw32 does.
8
9 declare double @acos(double %x)
10 define float @float_acos(float %x) nounwind readnone {
11 ; WIN32: @float_acos
12 ; WIN32-NOT: float @acosf
13 ; WIN32: double @acos
14 %1 = fpext float %x to double
15 %2 = call double @acos(double %1)
16 %3 = fptrunc double %2 to float
17 ret float %3
18 }
19
20 declare double @asin(double %x)
21 define float @float_asin(float %x) nounwind readnone {
22 ; WIN32: @float_asin
23 ; WIN32-NOT: float @asinf
24 ; WIN32: double @asin
25 %1 = fpext float %x to double
26 %2 = call double @asin(double %1)
27 %3 = fptrunc double %2 to float
28 ret float %3
29 }
30
31 declare double @atan(double %x)
32 define float @float_atan(float %x) nounwind readnone {
33 ; WIN32: @float_atan
34 ; WIN32-NOT: float @atanf
35 ; WIN32: double @atan
36 %1 = fpext float %x to double
37 %2 = call double @atan(double %1)
38 %3 = fptrunc double %2 to float
39 ret float %3
40 }
41
42 declare double @atan2(double %x, double %y)
43 define float @float_atan2(float %x, float %y) nounwind readnone {
44 ; WIN32: @float_atan2
45 ; WIN32-NOT: float @atan2f
46 ; WIN32: double @atan2
47 %1 = fpext float %x to double
48 %2 = fpext float %y to double
49 %3 = call double @atan2(double %1, double %2)
50 %4 = fptrunc double %3 to float
51 ret float %4
52 }
53
54 declare double @ceil(double %x)
55 define float @float_ceil(float %x) nounwind readnone {
56 ; WIN32: @float_ceil
57 ; WIN32-NOT: float @ceilf
58 ; WIN32: double @ceil
59 ; WIN64: @float_ceil
60 ; WIN64: float @ceilf
61 ; WIN64-NOT: double @ceil
62 ; MINGW32: @float_ceil
63 ; MINGW32: float @ceilf
64 ; MINGW32-NOT: double @ceil
65 ; MINGW64: @float_ceil
66 ; MINGW64: float @ceilf
67 ; MINGW64-NOT: double @ceil
68 %1 = fpext float %x to double
69 %2 = call double @ceil(double %1)
70 %3 = fptrunc double %2 to float
71 ret float %3
72 }
73
74 declare double @_copysign(double %x)
75 define float @float_copysign(float %x) nounwind readnone {
76 ; WIN32: @float_copysign
77 ; WIN32-NOT: float @copysignf
78 ; WIN32-NOT: float @_copysignf
79 ; WIN32: double @_copysign
80 %1 = fpext float %x to double
81 %2 = call double @_copysign(double %1)
82 %3 = fptrunc double %2 to float
83 ret float %3
84 }
85
86 declare double @cos(double %x)
87 define float @float_cos(float %x) nounwind readnone {
88 ; WIN32: @float_cos
89 ; WIN32-NOT: float @cosf
90 ; WIN32: double @cos
91 %1 = fpext float %x to double
92 %2 = call double @cos(double %1)
93 %3 = fptrunc double %2 to float
94 ret float %3
95 }
96
97 declare double @cosh(double %x)
98 define float @float_cosh(float %x) nounwind readnone {
99 ; WIN32: @float_cosh
100 ; WIN32-NOT: float @coshf
101 ; WIN32: double @cosh
102 %1 = fpext float %x to double
103 %2 = call double @cosh(double %1)
104 %3 = fptrunc double %2 to float
105 ret float %3
106 }
107
108 declare double @exp(double %x, double %y)
109 define float @float_exp(float %x, float %y) nounwind readnone {
110 ; WIN32: @float_exp
111 ; WIN32-NOT: float @expf
112 ; WIN32: double @exp
113 %1 = fpext float %x to double
114 %2 = fpext float %y to double
115 %3 = call double @exp(double %1, double %2)
116 %4 = fptrunc double %3 to float
117 ret float %4
118 }
119
120 declare double @fabs(double %x, double %y)
121 define float @float_fabs(float %x, float %y) nounwind readnone {
122 ; WIN32: @float_fabs
123 ; WIN32-NOT: float @fabsf
124 ; WIN32: double @fabs
125 ; WIN64: @float_fabs
126 ; WIN64-NOT: float @fabsf
127 ; WIN64: double @fabs
128 %1 = fpext float %x to double
129 %2 = fpext float %y to double
130 %3 = call double @fabs(double %1, double %2)
131 %4 = fptrunc double %3 to float
132 ret float %4
133 }
134
135 declare double @floor(double %x)
136 define float @float_floor(float %x) nounwind readnone {
137 ; WIN32: @float_floor
138 ; WIN32-NOT: float @floorf
139 ; WIN32: double @floor
140 ; WIN64: @float_floor
141 ; WIN64: float @floorf
142 ; WIN64-NOT: double @floor
143 ; MINGW32: @float_floor
144 ; MINGW32: float @floorf
145 ; MINGW32-NOT: double @floor
146 ; MINGW64: @float_floor
147 ; MINGW64: float @floorf
148 ; MINGW64-NOT: double @floor
149 %1 = fpext float %x to double
150 %2 = call double @floor(double %1)
151 %3 = fptrunc double %2 to float
152 ret float %3
153 }
154
155 declare double @fmod(double %x, double %y)
156 define float @float_fmod(float %x, float %y) nounwind readnone {
157 ; WIN32: @float_fmod
158 ; WIN32-NOT: float @fmodf
159 ; WIN32: double @fmod
160 %1 = fpext float %x to double
161 %2 = fpext float %y to double
162 %3 = call double @fmod(double %1, double %2)
163 %4 = fptrunc double %3 to float
164 ret float %4
165 }
166
167 declare double @log(double %x)
168 define float @float_log(float %x) nounwind readnone {
169 ; WIN32: @float_log
170 ; WIN32-NOT: float @logf
171 ; WIN32: double @log
172 %1 = fpext float %x to double
173 %2 = call double @log(double %1)
174 %3 = fptrunc double %2 to float
175 ret float %3
176 }
177
178 declare double @pow(double %x, double %y)
179 define float @float_pow(float %x, float %y) nounwind readnone {
180 ; WIN32: @float_pow
181 ; WIN32-NOT: float @powf
182 ; WIN32: double @pow
183 %1 = fpext float %x to double
184 %2 = fpext float %y to double
185 %3 = call double @pow(double %1, double %2)
186 %4 = fptrunc double %3 to float
187 ret float %4
188 }
189
190 declare double @sin(double %x)
191 define float @float_sin(float %x) nounwind readnone {
192 ; WIN32: @float_sin
193 ; WIN32-NOT: float @sinf
194 ; WIN32: double @sin
195 %1 = fpext float %x to double
196 %2 = call double @sin(double %1)
197 %3 = fptrunc double %2 to float
198 ret float %3
199 }
200
201 declare double @sinh(double %x)
202 define float @float_sinh(float %x) nounwind readnone {
203 ; WIN32: @float_sinh
204 ; WIN32-NOT: float @sinhf
205 ; WIN32: double @sinh
206 %1 = fpext float %x to double
207 %2 = call double @sinh(double %1)
208 %3 = fptrunc double %2 to float
209 ret float %3
210 }
211
212 declare double @sqrt(double %x)
213 define float @float_sqrt(float %x) nounwind readnone {
214 ; WIN32: @float_sqrt
215 ; WIN32-NOT: float @sqrtf
216 ; WIN32: double @sqrt
217 ; WIN64: @float_sqrt
218 ; WIN64: float @sqrtf
219 ; WIN64-NOT: double @sqrt
220 ; MINGW32: @float_sqrt
221 ; MINGW32: float @sqrtf
222 ; MINGW32-NOT: double @sqrt
223 ; MINGW64: @float_sqrt
224 ; MINGW64: float @sqrtf
225 ; MINGW64-NOT: double @sqrt
226 %1 = fpext float %x to double
227 %2 = call double @sqrt(double %1)
228 %3 = fptrunc double %2 to float
229 ret float %3
230 }
231
232 declare double @tan(double %x)
233 define float @float_tan(float %x) nounwind readnone {
234 ; WIN32: @float_tan
235 ; WIN32-NOT: float @tanf
236 ; WIN32: double @tan
237 %1 = fpext float %x to double
238 %2 = call double @tan(double %1)
239 %3 = fptrunc double %2 to float
240 ret float %3
241 }
242
243 declare double @tanh(double %x)
244 define float @float_tanh(float %x) nounwind readnone {
245 ; WIN32: @float_tanh
246 ; WIN32-NOT: float @tanhf
247 ; WIN32: double @tanh
248 %1 = fpext float %x to double
249 %2 = call double @tanh(double %1)
250 %3 = fptrunc double %2 to float
251 ret float %3
252 }
253
254 ; win32 does not have round; mingw32 does
255 declare double @round(double %x)
256 define float @float_round(float %x) nounwind readnone {
257 ; WIN32: @float_round
258 ; WIN32-NOT: float @roundf
259 ; WIN32: double @round
260 ; WIN64: @float_round
261 ; WIN64-NOT: float @roundf
262 ; WIN64: double @round
263 ; MINGW32: @float_round
264 ; MINGW32: float @roundf
265 ; MINGW32-NOT: double @round
266 ; MINGW64: @float_round
267 ; MINGW64: float @roundf
268 ; MINGW64-NOT: double @round
269 %1 = fpext float %x to double
270 %2 = call double @round(double %1)
271 %3 = fptrunc double %2 to float
272 ret float %3
273 }
274