authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-01-01 19:49:34-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-01-02 13:16:17-07:00
log6b14c58f63a177c26ed7ac51c25738ecb115462d
tree5197dba1170c3fb727e559b7c3b105d576f7c871
parent9dc25dd0b695c907e861bfd5a974cf454e657228

compiler-rt: simplify implementations

This improves readability as well as compatibility with stage2. Most of compiler-rt is now enabled for stage2 with just a few functions disabled (until stage2 passes more behavior tests).

18 files changed, 1152 insertions(+), 999 deletions(-)

lib/std/special/compiler_rt.zig+498-486
......@@ -22,6 +22,12 @@ else
2222const long_double_is_f128 = builtin.target.longDoubleIsF128();
2323
2424comptime {
25 // These files do their own comptime exporting logic.
26 if (!builtin.zig_is_stage2) {
27 _ = @import("compiler_rt/atomics.zig");
28 }
29 _ = @import("compiler_rt/clear_cache.zig").clear_cache;
30
2531 const __extenddftf2 = @import("compiler_rt/extendXfYf2.zig").__extenddftf2;
2632 @export(__extenddftf2, .{ .name = "__extenddftf2", .linkage = linkage });
2733 const __extendsftf2 = @import("compiler_rt/extendXfYf2.zig").__extendsftf2;
......@@ -171,16 +177,16 @@ comptime {
171177 const __truncdfsf2 = @import("compiler_rt/truncXfYf2.zig").__truncdfsf2;
172178 @export(__truncdfsf2, .{ .name = "__truncdfsf2", .linkage = linkage });
173179
174 if (!builtin.zig_is_stage2) {
175 if (!long_double_is_f128) {
176 // TODO implement these
177 //const __extendxftf2 = @import("compiler_rt/extendXfYf2.zig").__extendxftf2;
178 //@export(__extendxftf2, .{ .name = "__extendxftf2", .linkage = linkage });
180 if (!long_double_is_f128) {
181 // TODO implement these
182 //const __extendxftf2 = @import("compiler_rt/extendXfYf2.zig").__extendxftf2;
183 //@export(__extendxftf2, .{ .name = "__extendxftf2", .linkage = linkage });
179184
180 //const __trunctfxf2 = @import("compiler_rt/truncXfYf2.zig").__trunctfxf2;
181 //@export(__trunctfxf2, .{ .name = "__trunctfxf2", .linkage = linkage });
182 }
185 //const __trunctfxf2 = @import("compiler_rt/truncXfYf2.zig").__trunctfxf2;
186 //@export(__trunctfxf2, .{ .name = "__trunctfxf2", .linkage = linkage });
187 }
183188
189 if (!builtin.zig_is_stage2) {
184190 switch (arch) {
185191 .i386,
186192 .x86_64,
......@@ -193,30 +199,29 @@ comptime {
193199 },
194200 else => {},
195201 }
202 }
196203
197 // __clear_cache manages its own logic about whether to be exported or not.
198 _ = @import("compiler_rt/clear_cache.zig").clear_cache;
199
200 const __unordsf2 = @import("compiler_rt/compareXf2.zig").__unordsf2;
201 @export(__unordsf2, .{ .name = "__unordsf2", .linkage = linkage });
202 const __unorddf2 = @import("compiler_rt/compareXf2.zig").__unorddf2;
203 @export(__unorddf2, .{ .name = "__unorddf2", .linkage = linkage });
204 const __unordtf2 = @import("compiler_rt/compareXf2.zig").__unordtf2;
205 @export(__unordtf2, .{ .name = "__unordtf2", .linkage = linkage });
206
207 const __addsf3 = @import("compiler_rt/addXf3.zig").__addsf3;
208 @export(__addsf3, .{ .name = "__addsf3", .linkage = linkage });
209 const __adddf3 = @import("compiler_rt/addXf3.zig").__adddf3;
210 @export(__adddf3, .{ .name = "__adddf3", .linkage = linkage });
211 const __addtf3 = @import("compiler_rt/addXf3.zig").__addtf3;
212 @export(__addtf3, .{ .name = "__addtf3", .linkage = linkage });
213 const __subsf3 = @import("compiler_rt/addXf3.zig").__subsf3;
214 @export(__subsf3, .{ .name = "__subsf3", .linkage = linkage });
215 const __subdf3 = @import("compiler_rt/addXf3.zig").__subdf3;
216 @export(__subdf3, .{ .name = "__subdf3", .linkage = linkage });
217 const __subtf3 = @import("compiler_rt/addXf3.zig").__subtf3;
218 @export(__subtf3, .{ .name = "__subtf3", .linkage = linkage });
204 const __unordsf2 = @import("compiler_rt/compareXf2.zig").__unordsf2;
205 @export(__unordsf2, .{ .name = "__unordsf2", .linkage = linkage });
206 const __unorddf2 = @import("compiler_rt/compareXf2.zig").__unorddf2;
207 @export(__unorddf2, .{ .name = "__unorddf2", .linkage = linkage });
208 const __unordtf2 = @import("compiler_rt/compareXf2.zig").__unordtf2;
209 @export(__unordtf2, .{ .name = "__unordtf2", .linkage = linkage });
210
211 const __addsf3 = @import("compiler_rt/addXf3.zig").__addsf3;
212 @export(__addsf3, .{ .name = "__addsf3", .linkage = linkage });
213 const __adddf3 = @import("compiler_rt/addXf3.zig").__adddf3;
214 @export(__adddf3, .{ .name = "__adddf3", .linkage = linkage });
215 const __addtf3 = @import("compiler_rt/addXf3.zig").__addtf3;
216 @export(__addtf3, .{ .name = "__addtf3", .linkage = linkage });
217 const __subsf3 = @import("compiler_rt/addXf3.zig").__subsf3;
218 @export(__subsf3, .{ .name = "__subsf3", .linkage = linkage });
219 const __subdf3 = @import("compiler_rt/addXf3.zig").__subdf3;
220 @export(__subdf3, .{ .name = "__subdf3", .linkage = linkage });
221 const __subtf3 = @import("compiler_rt/addXf3.zig").__subtf3;
222 @export(__subtf3, .{ .name = "__subtf3", .linkage = linkage });
219223
224 if (!builtin.zig_is_stage2) {
220225 const __mulsf3 = @import("compiler_rt/mulXf3.zig").__mulsf3;
221226 @export(__mulsf3, .{ .name = "__mulsf3", .linkage = linkage });
222227 const __muldf3 = @import("compiler_rt/mulXf3.zig").__muldf3;
......@@ -230,21 +235,23 @@ comptime {
230235 @export(__divdf3, .{ .name = "__divdf3", .linkage = linkage });
231236 const __divtf3 = @import("compiler_rt/divtf3.zig").__divtf3;
232237 @export(__divtf3, .{ .name = "__divtf3", .linkage = linkage });
238 }
233239
234 // Integral bit manipulation
235 const __ashldi3 = @import("compiler_rt/shift.zig").__ashldi3;
236 @export(__ashldi3, .{ .name = "__ashldi3", .linkage = linkage });
237 const __ashlti3 = @import("compiler_rt/shift.zig").__ashlti3;
238 @export(__ashlti3, .{ .name = "__ashlti3", .linkage = linkage });
239 const __ashrdi3 = @import("compiler_rt/shift.zig").__ashrdi3;
240 @export(__ashrdi3, .{ .name = "__ashrdi3", .linkage = linkage });
241 const __ashrti3 = @import("compiler_rt/shift.zig").__ashrti3;
242 @export(__ashrti3, .{ .name = "__ashrti3", .linkage = linkage });
243 const __lshrdi3 = @import("compiler_rt/shift.zig").__lshrdi3;
244 @export(__lshrdi3, .{ .name = "__lshrdi3", .linkage = linkage });
245 const __lshrti3 = @import("compiler_rt/shift.zig").__lshrti3;
246 @export(__lshrti3, .{ .name = "__lshrti3", .linkage = linkage });
240 // Integral bit manipulation
241 const __ashldi3 = @import("compiler_rt/shift.zig").__ashldi3;
242 @export(__ashldi3, .{ .name = "__ashldi3", .linkage = linkage });
243 const __ashlti3 = @import("compiler_rt/shift.zig").__ashlti3;
244 @export(__ashlti3, .{ .name = "__ashlti3", .linkage = linkage });
245 const __ashrdi3 = @import("compiler_rt/shift.zig").__ashrdi3;
246 @export(__ashrdi3, .{ .name = "__ashrdi3", .linkage = linkage });
247 const __ashrti3 = @import("compiler_rt/shift.zig").__ashrti3;
248 @export(__ashrti3, .{ .name = "__ashrti3", .linkage = linkage });
249 const __lshrdi3 = @import("compiler_rt/shift.zig").__lshrdi3;
250 @export(__lshrdi3, .{ .name = "__lshrdi3", .linkage = linkage });
251 const __lshrti3 = @import("compiler_rt/shift.zig").__lshrti3;
252 @export(__lshrti3, .{ .name = "__lshrti3", .linkage = linkage });
247253
254 if (!builtin.zig_is_stage2) {
248255 const __clzsi2 = @import("compiler_rt/count0bits.zig").__clzsi2;
249256 @export(__clzsi2, .{ .name = "__clzsi2", .linkage = linkage });
250257 const __clzdi2 = @import("compiler_rt/count0bits.zig").__clzdi2;
......@@ -263,461 +270,466 @@ comptime {
263270 @export(__ffsdi2, .{ .name = "__ffsdi2", .linkage = linkage });
264271 const __ffsti2 = @import("compiler_rt/count0bits.zig").__ffsti2;
265272 @export(__ffsti2, .{ .name = "__ffsti2", .linkage = linkage });
273 }
266274
267 const __paritysi2 = @import("compiler_rt/parity.zig").__paritysi2;
268 @export(__paritysi2, .{ .name = "__paritysi2", .linkage = linkage });
269 const __paritydi2 = @import("compiler_rt/parity.zig").__paritydi2;
270 @export(__paritydi2, .{ .name = "__paritydi2", .linkage = linkage });
271 const __parityti2 = @import("compiler_rt/parity.zig").__parityti2;
272 @export(__parityti2, .{ .name = "__parityti2", .linkage = linkage });
273 const __popcountsi2 = @import("compiler_rt/popcount.zig").__popcountsi2;
274 @export(__popcountsi2, .{ .name = "__popcountsi2", .linkage = linkage });
275 const __popcountdi2 = @import("compiler_rt/popcount.zig").__popcountdi2;
276 @export(__popcountdi2, .{ .name = "__popcountdi2", .linkage = linkage });
277 const __popcountti2 = @import("compiler_rt/popcount.zig").__popcountti2;
278 @export(__popcountti2, .{ .name = "__popcountti2", .linkage = linkage });
279 const __bswapsi2 = @import("compiler_rt/bswap.zig").__bswapsi2;
280 @export(__bswapsi2, .{ .name = "__bswapsi2", .linkage = linkage });
281 const __bswapdi2 = @import("compiler_rt/bswap.zig").__bswapdi2;
282 @export(__bswapdi2, .{ .name = "__bswapdi2", .linkage = linkage });
283 const __bswapti2 = @import("compiler_rt/bswap.zig").__bswapti2;
284 @export(__bswapti2, .{ .name = "__bswapti2", .linkage = linkage });
285
286 // Integral / floating point conversion (part 1/2)
287 const __floatsidf = @import("compiler_rt/floatsiXf.zig").__floatsidf;
288 @export(__floatsidf, .{ .name = "__floatsidf", .linkage = linkage });
289 const __floatsisf = @import("compiler_rt/floatsiXf.zig").__floatsisf;
290 @export(__floatsisf, .{ .name = "__floatsisf", .linkage = linkage });
291 const __floatdidf = @import("compiler_rt/floatdidf.zig").__floatdidf;
292 @export(__floatdidf, .{ .name = "__floatdidf", .linkage = linkage });
293 const __floatsitf = @import("compiler_rt/floatsiXf.zig").__floatsitf;
294 @export(__floatsitf, .{ .name = "__floatsitf", .linkage = linkage });
295
296 const __floatunsisf = @import("compiler_rt/floatunsisf.zig").__floatunsisf;
297 @export(__floatunsisf, .{ .name = "__floatunsisf", .linkage = linkage });
275 const __paritysi2 = @import("compiler_rt/parity.zig").__paritysi2;
276 @export(__paritysi2, .{ .name = "__paritysi2", .linkage = linkage });
277 const __paritydi2 = @import("compiler_rt/parity.zig").__paritydi2;
278 @export(__paritydi2, .{ .name = "__paritydi2", .linkage = linkage });
279 const __parityti2 = @import("compiler_rt/parity.zig").__parityti2;
280 @export(__parityti2, .{ .name = "__parityti2", .linkage = linkage });
281
282 const __popcountsi2 = @import("compiler_rt/popcount.zig").__popcountsi2;
283 @export(__popcountsi2, .{ .name = "__popcountsi2", .linkage = linkage });
284 const __popcountdi2 = @import("compiler_rt/popcount.zig").__popcountdi2;
285 @export(__popcountdi2, .{ .name = "__popcountdi2", .linkage = linkage });
286 const __popcountti2 = @import("compiler_rt/popcount.zig").__popcountti2;
287 @export(__popcountti2, .{ .name = "__popcountti2", .linkage = linkage });
288
289 const __bswapsi2 = @import("compiler_rt/bswap.zig").__bswapsi2;
290 @export(__bswapsi2, .{ .name = "__bswapsi2", .linkage = linkage });
291 const __bswapdi2 = @import("compiler_rt/bswap.zig").__bswapdi2;
292 @export(__bswapdi2, .{ .name = "__bswapdi2", .linkage = linkage });
293 const __bswapti2 = @import("compiler_rt/bswap.zig").__bswapti2;
294 @export(__bswapti2, .{ .name = "__bswapti2", .linkage = linkage });
295
296 // Integral / floating point conversion (part 1/2)
297 const __floatsidf = @import("compiler_rt/floatsiXf.zig").__floatsidf;
298 @export(__floatsidf, .{ .name = "__floatsidf", .linkage = linkage });
299 const __floatsisf = @import("compiler_rt/floatsiXf.zig").__floatsisf;
300 @export(__floatsisf, .{ .name = "__floatsisf", .linkage = linkage });
301 const __floatdidf = @import("compiler_rt/floatdidf.zig").__floatdidf;
302 @export(__floatdidf, .{ .name = "__floatdidf", .linkage = linkage });
303 const __floatsitf = @import("compiler_rt/floatsiXf.zig").__floatsitf;
304 @export(__floatsitf, .{ .name = "__floatsitf", .linkage = linkage });
305
306 const __floatunsisf = @import("compiler_rt/floatunsisf.zig").__floatunsisf;
307 @export(__floatunsisf, .{ .name = "__floatunsisf", .linkage = linkage });
308 if (!builtin.zig_is_stage2) {
298309 const __floatundisf = @import("compiler_rt/floatundisf.zig").__floatundisf;
299310 @export(__floatundisf, .{ .name = "__floatundisf", .linkage = linkage });
300 const __floatunsidf = @import("compiler_rt/floatunsidf.zig").__floatunsidf;
301 @export(__floatunsidf, .{ .name = "__floatunsidf", .linkage = linkage });
302 const __floatundidf = @import("compiler_rt/floatundidf.zig").__floatundidf;
303 @export(__floatundidf, .{ .name = "__floatundidf", .linkage = linkage });
304
305 const __floatditf = @import("compiler_rt/floatditf.zig").__floatditf;
306 @export(__floatditf, .{ .name = "__floatditf", .linkage = linkage });
307 const __floattitf = @import("compiler_rt/floattitf.zig").__floattitf;
308 @export(__floattitf, .{ .name = "__floattitf", .linkage = linkage });
309 const __floattidf = @import("compiler_rt/floattidf.zig").__floattidf;
310 @export(__floattidf, .{ .name = "__floattidf", .linkage = linkage });
311 const __floattisf = @import("compiler_rt/floatXisf.zig").__floattisf;
312 @export(__floattisf, .{ .name = "__floattisf", .linkage = linkage });
313 const __floatdisf = @import("compiler_rt/floatXisf.zig").__floatdisf;
314 @export(__floatdisf, .{ .name = "__floatdisf", .linkage = linkage });
315
316 const __floatunditf = @import("compiler_rt/floatunditf.zig").__floatunditf;
317 @export(__floatunditf, .{ .name = "__floatunditf", .linkage = linkage });
318 const __floatunsitf = @import("compiler_rt/floatunsitf.zig").__floatunsitf;
319 @export(__floatunsitf, .{ .name = "__floatunsitf", .linkage = linkage });
320
321 const __floatuntitf = @import("compiler_rt/floatuntitf.zig").__floatuntitf;
322 @export(__floatuntitf, .{ .name = "__floatuntitf", .linkage = linkage });
323 const __floatuntidf = @import("compiler_rt/floatuntidf.zig").__floatuntidf;
324 @export(__floatuntidf, .{ .name = "__floatuntidf", .linkage = linkage });
325 const __floatuntisf = @import("compiler_rt/floatuntisf.zig").__floatuntisf;
326 @export(__floatuntisf, .{ .name = "__floatuntisf", .linkage = linkage });
327
328 const __truncsfhf2 = @import("compiler_rt/truncXfYf2.zig").__truncsfhf2;
329 @export(__truncsfhf2, .{ .name = "__truncsfhf2", .linkage = linkage });
330 if (!is_test) {
331 @export(__truncsfhf2, .{ .name = "__gnu_f2h_ieee", .linkage = linkage });
332 }
333 const __extendsfdf2 = @import("compiler_rt/extendXfYf2.zig").__extendsfdf2;
334 @export(__extendsfdf2, .{ .name = "__extendsfdf2", .linkage = linkage });
335
336 // Integral / floating point conversion (part 2/2)
337 const __fixunssfsi = @import("compiler_rt/fixunssfsi.zig").__fixunssfsi;
338 @export(__fixunssfsi, .{ .name = "__fixunssfsi", .linkage = linkage });
339 const __fixunssfdi = @import("compiler_rt/fixunssfdi.zig").__fixunssfdi;
340 @export(__fixunssfdi, .{ .name = "__fixunssfdi", .linkage = linkage });
341 const __fixunssfti = @import("compiler_rt/fixunssfti.zig").__fixunssfti;
342 @export(__fixunssfti, .{ .name = "__fixunssfti", .linkage = linkage });
343
344 const __fixunsdfsi = @import("compiler_rt/fixunsdfsi.zig").__fixunsdfsi;
345 @export(__fixunsdfsi, .{ .name = "__fixunsdfsi", .linkage = linkage });
346 const __fixunsdfdi = @import("compiler_rt/fixunsdfdi.zig").__fixunsdfdi;
347 @export(__fixunsdfdi, .{ .name = "__fixunsdfdi", .linkage = linkage });
348 const __fixunsdfti = @import("compiler_rt/fixunsdfti.zig").__fixunsdfti;
349 @export(__fixunsdfti, .{ .name = "__fixunsdfti", .linkage = linkage });
350
351 const __fixunstfsi = @import("compiler_rt/fixunstfsi.zig").__fixunstfsi;
352 @export(__fixunstfsi, .{ .name = "__fixunstfsi", .linkage = linkage });
353 const __fixunstfdi = @import("compiler_rt/fixunstfdi.zig").__fixunstfdi;
354 @export(__fixunstfdi, .{ .name = "__fixunstfdi", .linkage = linkage });
355 const __fixunstfti = @import("compiler_rt/fixunstfti.zig").__fixunstfti;
356 @export(__fixunstfti, .{ .name = "__fixunstfti", .linkage = linkage });
357
358 const __fixdfdi = @import("compiler_rt/fixdfdi.zig").__fixdfdi;
359 @export(__fixdfdi, .{ .name = "__fixdfdi", .linkage = linkage });
360 const __fixdfsi = @import("compiler_rt/fixdfsi.zig").__fixdfsi;
361 @export(__fixdfsi, .{ .name = "__fixdfsi", .linkage = linkage });
362 const __fixdfti = @import("compiler_rt/fixdfti.zig").__fixdfti;
363 @export(__fixdfti, .{ .name = "__fixdfti", .linkage = linkage });
364 const __fixsfdi = @import("compiler_rt/fixsfdi.zig").__fixsfdi;
365 @export(__fixsfdi, .{ .name = "__fixsfdi", .linkage = linkage });
366 const __fixsfsi = @import("compiler_rt/fixsfsi.zig").__fixsfsi;
367 @export(__fixsfsi, .{ .name = "__fixsfsi", .linkage = linkage });
368 const __fixsfti = @import("compiler_rt/fixsfti.zig").__fixsfti;
369 @export(__fixsfti, .{ .name = "__fixsfti", .linkage = linkage });
370 const __fixtfdi = @import("compiler_rt/fixtfdi.zig").__fixtfdi;
371 @export(__fixtfdi, .{ .name = "__fixtfdi", .linkage = linkage });
372 const __fixtfsi = @import("compiler_rt/fixtfsi.zig").__fixtfsi;
373 @export(__fixtfsi, .{ .name = "__fixtfsi", .linkage = linkage });
374 const __fixtfti = @import("compiler_rt/fixtfti.zig").__fixtfti;
375 @export(__fixtfti, .{ .name = "__fixtfti", .linkage = linkage });
376
377 const __udivmoddi4 = @import("compiler_rt/int.zig").__udivmoddi4;
378 @export(__udivmoddi4, .{ .name = "__udivmoddi4", .linkage = linkage });
379
380 if (is_darwin) {
381 const __isPlatformVersionAtLeast = @import("compiler_rt/os_version_check.zig").__isPlatformVersionAtLeast;
382 @export(__isPlatformVersionAtLeast, .{ .name = "__isPlatformVersionAtLeast", .linkage = linkage });
383 }
311 }
312 const __floatunsidf = @import("compiler_rt/floatunsidf.zig").__floatunsidf;
313 @export(__floatunsidf, .{ .name = "__floatunsidf", .linkage = linkage });
314 const __floatundidf = @import("compiler_rt/floatundidf.zig").__floatundidf;
315 @export(__floatundidf, .{ .name = "__floatundidf", .linkage = linkage });
316
317 const __floatditf = @import("compiler_rt/floatditf.zig").__floatditf;
318 @export(__floatditf, .{ .name = "__floatditf", .linkage = linkage });
319 const __floattitf = @import("compiler_rt/floattitf.zig").__floattitf;
320 @export(__floattitf, .{ .name = "__floattitf", .linkage = linkage });
321 const __floattidf = @import("compiler_rt/floattidf.zig").__floattidf;
322 @export(__floattidf, .{ .name = "__floattidf", .linkage = linkage });
323 const __floattisf = @import("compiler_rt/floatXisf.zig").__floattisf;
324 @export(__floattisf, .{ .name = "__floattisf", .linkage = linkage });
325 const __floatdisf = @import("compiler_rt/floatXisf.zig").__floatdisf;
326 @export(__floatdisf, .{ .name = "__floatdisf", .linkage = linkage });
327
328 const __floatunditf = @import("compiler_rt/floatunditf.zig").__floatunditf;
329 @export(__floatunditf, .{ .name = "__floatunditf", .linkage = linkage });
330 const __floatunsitf = @import("compiler_rt/floatunsitf.zig").__floatunsitf;
331 @export(__floatunsitf, .{ .name = "__floatunsitf", .linkage = linkage });
332
333 const __floatuntitf = @import("compiler_rt/floatuntitf.zig").__floatuntitf;
334 @export(__floatuntitf, .{ .name = "__floatuntitf", .linkage = linkage });
335 const __floatuntidf = @import("compiler_rt/floatuntidf.zig").__floatuntidf;
336 @export(__floatuntidf, .{ .name = "__floatuntidf", .linkage = linkage });
337 const __floatuntisf = @import("compiler_rt/floatuntisf.zig").__floatuntisf;
338 @export(__floatuntisf, .{ .name = "__floatuntisf", .linkage = linkage });
339
340 const __truncsfhf2 = @import("compiler_rt/truncXfYf2.zig").__truncsfhf2;
341 @export(__truncsfhf2, .{ .name = "__truncsfhf2", .linkage = linkage });
342 if (!is_test) {
343 @export(__truncsfhf2, .{ .name = "__gnu_f2h_ieee", .linkage = linkage });
344 }
345 const __extendsfdf2 = @import("compiler_rt/extendXfYf2.zig").__extendsfdf2;
346 @export(__extendsfdf2, .{ .name = "__extendsfdf2", .linkage = linkage });
347
348 // Integral / floating point conversion (part 2/2)
349 const __fixunssfsi = @import("compiler_rt/fixunssfsi.zig").__fixunssfsi;
350 @export(__fixunssfsi, .{ .name = "__fixunssfsi", .linkage = linkage });
351 const __fixunssfdi = @import("compiler_rt/fixunssfdi.zig").__fixunssfdi;
352 @export(__fixunssfdi, .{ .name = "__fixunssfdi", .linkage = linkage });
353 const __fixunssfti = @import("compiler_rt/fixunssfti.zig").__fixunssfti;
354 @export(__fixunssfti, .{ .name = "__fixunssfti", .linkage = linkage });
355
356 const __fixunsdfsi = @import("compiler_rt/fixunsdfsi.zig").__fixunsdfsi;
357 @export(__fixunsdfsi, .{ .name = "__fixunsdfsi", .linkage = linkage });
358 const __fixunsdfdi = @import("compiler_rt/fixunsdfdi.zig").__fixunsdfdi;
359 @export(__fixunsdfdi, .{ .name = "__fixunsdfdi", .linkage = linkage });
360 const __fixunsdfti = @import("compiler_rt/fixunsdfti.zig").__fixunsdfti;
361 @export(__fixunsdfti, .{ .name = "__fixunsdfti", .linkage = linkage });
362
363 const __fixunstfsi = @import("compiler_rt/fixunstfsi.zig").__fixunstfsi;
364 @export(__fixunstfsi, .{ .name = "__fixunstfsi", .linkage = linkage });
365 const __fixunstfdi = @import("compiler_rt/fixunstfdi.zig").__fixunstfdi;
366 @export(__fixunstfdi, .{ .name = "__fixunstfdi", .linkage = linkage });
367 const __fixunstfti = @import("compiler_rt/fixunstfti.zig").__fixunstfti;
368 @export(__fixunstfti, .{ .name = "__fixunstfti", .linkage = linkage });
369
370 const __fixdfdi = @import("compiler_rt/fixdfdi.zig").__fixdfdi;
371 @export(__fixdfdi, .{ .name = "__fixdfdi", .linkage = linkage });
372 const __fixdfsi = @import("compiler_rt/fixdfsi.zig").__fixdfsi;
373 @export(__fixdfsi, .{ .name = "__fixdfsi", .linkage = linkage });
374 const __fixdfti = @import("compiler_rt/fixdfti.zig").__fixdfti;
375 @export(__fixdfti, .{ .name = "__fixdfti", .linkage = linkage });
376 const __fixsfdi = @import("compiler_rt/fixsfdi.zig").__fixsfdi;
377 @export(__fixsfdi, .{ .name = "__fixsfdi", .linkage = linkage });
378 const __fixsfsi = @import("compiler_rt/fixsfsi.zig").__fixsfsi;
379 @export(__fixsfsi, .{ .name = "__fixsfsi", .linkage = linkage });
380 const __fixsfti = @import("compiler_rt/fixsfti.zig").__fixsfti;
381 @export(__fixsfti, .{ .name = "__fixsfti", .linkage = linkage });
382 const __fixtfdi = @import("compiler_rt/fixtfdi.zig").__fixtfdi;
383 @export(__fixtfdi, .{ .name = "__fixtfdi", .linkage = linkage });
384 const __fixtfsi = @import("compiler_rt/fixtfsi.zig").__fixtfsi;
385 @export(__fixtfsi, .{ .name = "__fixtfsi", .linkage = linkage });
386 const __fixtfti = @import("compiler_rt/fixtfti.zig").__fixtfti;
387 @export(__fixtfti, .{ .name = "__fixtfti", .linkage = linkage });
388
389 const __udivmoddi4 = @import("compiler_rt/int.zig").__udivmoddi4;
390 @export(__udivmoddi4, .{ .name = "__udivmoddi4", .linkage = linkage });
391
392 if (is_darwin) {
393 const __isPlatformVersionAtLeast = @import("compiler_rt/os_version_check.zig").__isPlatformVersionAtLeast;
394 @export(__isPlatformVersionAtLeast, .{ .name = "__isPlatformVersionAtLeast", .linkage = linkage });
395 }
384396
385 // Integral arithmetic
386 const __negsi2 = @import("compiler_rt/negXi2.zig").__negsi2;
387 @export(__negsi2, .{ .name = "__negsi2", .linkage = linkage });
388 const __negdi2 = @import("compiler_rt/negXi2.zig").__negdi2;
389 @export(__negdi2, .{ .name = "__negdi2", .linkage = linkage });
390 const __negti2 = @import("compiler_rt/negXi2.zig").__negti2;
391 @export(__negti2, .{ .name = "__negti2", .linkage = linkage });
392 const __mulsi3 = @import("compiler_rt/int.zig").__mulsi3;
393 @export(__mulsi3, .{ .name = "__mulsi3", .linkage = linkage });
394 const __muldi3 = @import("compiler_rt/muldi3.zig").__muldi3;
395 @export(__muldi3, .{ .name = "__muldi3", .linkage = linkage });
396 const __divmoddi4 = @import("compiler_rt/int.zig").__divmoddi4;
397 @export(__divmoddi4, .{ .name = "__divmoddi4", .linkage = linkage });
398 const __divsi3 = @import("compiler_rt/int.zig").__divsi3;
399 @export(__divsi3, .{ .name = "__divsi3", .linkage = linkage });
400 const __divdi3 = @import("compiler_rt/int.zig").__divdi3;
401 @export(__divdi3, .{ .name = "__divdi3", .linkage = linkage });
402 const __udivsi3 = @import("compiler_rt/int.zig").__udivsi3;
403 @export(__udivsi3, .{ .name = "__udivsi3", .linkage = linkage });
404 const __udivdi3 = @import("compiler_rt/int.zig").__udivdi3;
405 @export(__udivdi3, .{ .name = "__udivdi3", .linkage = linkage });
406 const __modsi3 = @import("compiler_rt/int.zig").__modsi3;
407 @export(__modsi3, .{ .name = "__modsi3", .linkage = linkage });
408 const __moddi3 = @import("compiler_rt/int.zig").__moddi3;
409 @export(__moddi3, .{ .name = "__moddi3", .linkage = linkage });
410 const __umodsi3 = @import("compiler_rt/int.zig").__umodsi3;
411 @export(__umodsi3, .{ .name = "__umodsi3", .linkage = linkage });
412 const __umoddi3 = @import("compiler_rt/int.zig").__umoddi3;
413 @export(__umoddi3, .{ .name = "__umoddi3", .linkage = linkage });
414 const __divmodsi4 = @import("compiler_rt/int.zig").__divmodsi4;
415 @export(__divmodsi4, .{ .name = "__divmodsi4", .linkage = linkage });
416 const __udivmodsi4 = @import("compiler_rt/int.zig").__udivmodsi4;
417 @export(__udivmodsi4, .{ .name = "__udivmodsi4", .linkage = linkage });
418
419 // Integral arithmetic with trapping overflow
420 const __absvsi2 = @import("compiler_rt/absv.zig").__absvsi2;
421 @export(__absvsi2, .{ .name = "__absvsi2", .linkage = linkage });
422 const __absvdi2 = @import("compiler_rt/absv.zig").__absvdi2;
423 @export(__absvdi2, .{ .name = "__absvdi2", .linkage = linkage });
424 const __absvti2 = @import("compiler_rt/absv.zig").__absvti2;
425 @export(__absvti2, .{ .name = "__absvti2", .linkage = linkage });
426 const __negvsi2 = @import("compiler_rt/negv.zig").__negvsi2;
427 @export(__negvsi2, .{ .name = "__negvsi2", .linkage = linkage });
428 const __negvdi2 = @import("compiler_rt/negv.zig").__negvdi2;
429 @export(__negvdi2, .{ .name = "__negvdi2", .linkage = linkage });
430 const __negvti2 = @import("compiler_rt/negv.zig").__negvti2;
431 @export(__negvti2, .{ .name = "__negvti2", .linkage = linkage });
432
433 // missing: Integral arithmetic which returns if overflow
434
435 // Integral comparison
436 // (a < b) => 0
437 // (a == b) => 1
438 // (a > b) => 2
439 const __cmpsi2 = @import("compiler_rt/cmp.zig").__cmpsi2;
440 @export(__cmpsi2, .{ .name = "__cmpsi2", .linkage = linkage });
441 const __cmpdi2 = @import("compiler_rt/cmp.zig").__cmpdi2;
442 @export(__cmpdi2, .{ .name = "__cmpdi2", .linkage = linkage });
443 const __cmpti2 = @import("compiler_rt/cmp.zig").__cmpti2;
444 @export(__cmpti2, .{ .name = "__cmpti2", .linkage = linkage });
445 const __ucmpsi2 = @import("compiler_rt/cmp.zig").__ucmpsi2;
446 @export(__ucmpsi2, .{ .name = "__ucmpsi2", .linkage = linkage });
447 const __ucmpdi2 = @import("compiler_rt/cmp.zig").__ucmpdi2;
448 @export(__ucmpdi2, .{ .name = "__ucmpdi2", .linkage = linkage });
449 const __ucmpti2 = @import("compiler_rt/cmp.zig").__ucmpti2;
450 @export(__ucmpti2, .{ .name = "__ucmpti2", .linkage = linkage });
451
452 // missing: Floating point raised to integer power
453
454 // missing: Complex arithmetic
455 // (a + ib) * (c + id)
456 // (a + ib) / (c + id)
457
458 const __negsf2 = @import("compiler_rt/negXf2.zig").__negsf2;
459 @export(__negsf2, .{ .name = "__negsf2", .linkage = linkage });
460 const __negdf2 = @import("compiler_rt/negXf2.zig").__negdf2;
461 @export(__negdf2, .{ .name = "__negdf2", .linkage = linkage });
462
463 if (builtin.link_libc and os_tag == .openbsd) {
464 const __emutls_get_address = @import("compiler_rt/emutls.zig").__emutls_get_address;
465 @export(__emutls_get_address, .{ .name = "__emutls_get_address", .linkage = linkage });
466 }
397 // Integral arithmetic
398 const __negsi2 = @import("compiler_rt/negXi2.zig").__negsi2;
399 @export(__negsi2, .{ .name = "__negsi2", .linkage = linkage });
400 const __negdi2 = @import("compiler_rt/negXi2.zig").__negdi2;
401 @export(__negdi2, .{ .name = "__negdi2", .linkage = linkage });
402 const __negti2 = @import("compiler_rt/negXi2.zig").__negti2;
403 @export(__negti2, .{ .name = "__negti2", .linkage = linkage });
404 const __mulsi3 = @import("compiler_rt/int.zig").__mulsi3;
405 @export(__mulsi3, .{ .name = "__mulsi3", .linkage = linkage });
406 const __muldi3 = @import("compiler_rt/muldi3.zig").__muldi3;
407 @export(__muldi3, .{ .name = "__muldi3", .linkage = linkage });
408 const __divmoddi4 = @import("compiler_rt/int.zig").__divmoddi4;
409 @export(__divmoddi4, .{ .name = "__divmoddi4", .linkage = linkage });
410 const __divsi3 = @import("compiler_rt/int.zig").__divsi3;
411 @export(__divsi3, .{ .name = "__divsi3", .linkage = linkage });
412 const __divdi3 = @import("compiler_rt/int.zig").__divdi3;
413 @export(__divdi3, .{ .name = "__divdi3", .linkage = linkage });
414 const __udivsi3 = @import("compiler_rt/int.zig").__udivsi3;
415 @export(__udivsi3, .{ .name = "__udivsi3", .linkage = linkage });
416 const __udivdi3 = @import("compiler_rt/int.zig").__udivdi3;
417 @export(__udivdi3, .{ .name = "__udivdi3", .linkage = linkage });
418 const __modsi3 = @import("compiler_rt/int.zig").__modsi3;
419 @export(__modsi3, .{ .name = "__modsi3", .linkage = linkage });
420 const __moddi3 = @import("compiler_rt/int.zig").__moddi3;
421 @export(__moddi3, .{ .name = "__moddi3", .linkage = linkage });
422 const __umodsi3 = @import("compiler_rt/int.zig").__umodsi3;
423 @export(__umodsi3, .{ .name = "__umodsi3", .linkage = linkage });
424 const __umoddi3 = @import("compiler_rt/int.zig").__umoddi3;
425 @export(__umoddi3, .{ .name = "__umoddi3", .linkage = linkage });
426 const __divmodsi4 = @import("compiler_rt/int.zig").__divmodsi4;
427 @export(__divmodsi4, .{ .name = "__divmodsi4", .linkage = linkage });
428 const __udivmodsi4 = @import("compiler_rt/int.zig").__udivmodsi4;
429 @export(__udivmodsi4, .{ .name = "__udivmodsi4", .linkage = linkage });
430
431 // Integral arithmetic with trapping overflow
432 const __absvsi2 = @import("compiler_rt/absv.zig").__absvsi2;
433 @export(__absvsi2, .{ .name = "__absvsi2", .linkage = linkage });
434 const __absvdi2 = @import("compiler_rt/absv.zig").__absvdi2;
435 @export(__absvdi2, .{ .name = "__absvdi2", .linkage = linkage });
436 const __absvti2 = @import("compiler_rt/absv.zig").__absvti2;
437 @export(__absvti2, .{ .name = "__absvti2", .linkage = linkage });
438 const __negvsi2 = @import("compiler_rt/negv.zig").__negvsi2;
439 @export(__negvsi2, .{ .name = "__negvsi2", .linkage = linkage });
440 const __negvdi2 = @import("compiler_rt/negv.zig").__negvdi2;
441 @export(__negvdi2, .{ .name = "__negvdi2", .linkage = linkage });
442 const __negvti2 = @import("compiler_rt/negv.zig").__negvti2;
443 @export(__negvti2, .{ .name = "__negvti2", .linkage = linkage });
444
445 // missing: Integral arithmetic which returns if overflow
446
447 // Integral comparison
448 // (a < b) => 0
449 // (a == b) => 1
450 // (a > b) => 2
451 const __cmpsi2 = @import("compiler_rt/cmp.zig").__cmpsi2;
452 @export(__cmpsi2, .{ .name = "__cmpsi2", .linkage = linkage });
453 const __cmpdi2 = @import("compiler_rt/cmp.zig").__cmpdi2;
454 @export(__cmpdi2, .{ .name = "__cmpdi2", .linkage = linkage });
455 const __cmpti2 = @import("compiler_rt/cmp.zig").__cmpti2;
456 @export(__cmpti2, .{ .name = "__cmpti2", .linkage = linkage });
457 const __ucmpsi2 = @import("compiler_rt/cmp.zig").__ucmpsi2;
458 @export(__ucmpsi2, .{ .name = "__ucmpsi2", .linkage = linkage });
459 const __ucmpdi2 = @import("compiler_rt/cmp.zig").__ucmpdi2;
460 @export(__ucmpdi2, .{ .name = "__ucmpdi2", .linkage = linkage });
461 const __ucmpti2 = @import("compiler_rt/cmp.zig").__ucmpti2;
462 @export(__ucmpti2, .{ .name = "__ucmpti2", .linkage = linkage });
463
464 // missing: Floating point raised to integer power
465
466 // missing: Complex arithmetic
467 // (a + ib) * (c + id)
468 // (a + ib) / (c + id)
469
470 const __negsf2 = @import("compiler_rt/negXf2.zig").__negsf2;
471 @export(__negsf2, .{ .name = "__negsf2", .linkage = linkage });
472 const __negdf2 = @import("compiler_rt/negXf2.zig").__negdf2;
473 @export(__negdf2, .{ .name = "__negdf2", .linkage = linkage });
474
475 if (builtin.link_libc and os_tag == .openbsd) {
476 const __emutls_get_address = @import("compiler_rt/emutls.zig").__emutls_get_address;
477 @export(__emutls_get_address, .{ .name = "__emutls_get_address", .linkage = linkage });
478 }
467479
468 if ((arch.isARM() or arch.isThumb()) and !is_test) {
469 const __aeabi_unwind_cpp_pr0 = @import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr0;
470 @export(__aeabi_unwind_cpp_pr0, .{ .name = "__aeabi_unwind_cpp_pr0", .linkage = linkage });
471 const __aeabi_unwind_cpp_pr1 = @import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr1;
472 @export(__aeabi_unwind_cpp_pr1, .{ .name = "__aeabi_unwind_cpp_pr1", .linkage = linkage });
473 const __aeabi_unwind_cpp_pr2 = @import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr2;
474 @export(__aeabi_unwind_cpp_pr2, .{ .name = "__aeabi_unwind_cpp_pr2", .linkage = linkage });
475
476 @export(__muldi3, .{ .name = "__aeabi_lmul", .linkage = linkage });
477
478 const __aeabi_ldivmod = @import("compiler_rt/arm.zig").__aeabi_ldivmod;
479 @export(__aeabi_ldivmod, .{ .name = "__aeabi_ldivmod", .linkage = linkage });
480 const __aeabi_uldivmod = @import("compiler_rt/arm.zig").__aeabi_uldivmod;
481 @export(__aeabi_uldivmod, .{ .name = "__aeabi_uldivmod", .linkage = linkage });
482
483 @export(__divsi3, .{ .name = "__aeabi_idiv", .linkage = linkage });
484 const __aeabi_idivmod = @import("compiler_rt/arm.zig").__aeabi_idivmod;
485 @export(__aeabi_idivmod, .{ .name = "__aeabi_idivmod", .linkage = linkage });
486 @export(__udivsi3, .{ .name = "__aeabi_uidiv", .linkage = linkage });
487 const __aeabi_uidivmod = @import("compiler_rt/arm.zig").__aeabi_uidivmod;
488 @export(__aeabi_uidivmod, .{ .name = "__aeabi_uidivmod", .linkage = linkage });
489
490 const __aeabi_memcpy = @import("compiler_rt/arm.zig").__aeabi_memcpy;
491 @export(__aeabi_memcpy, .{ .name = "__aeabi_memcpy", .linkage = linkage });
492 @export(__aeabi_memcpy, .{ .name = "__aeabi_memcpy4", .linkage = linkage });
493 @export(__aeabi_memcpy, .{ .name = "__aeabi_memcpy8", .linkage = linkage });
494
495 const __aeabi_memmove = @import("compiler_rt/arm.zig").__aeabi_memmove;
496 @export(__aeabi_memmove, .{ .name = "__aeabi_memmove", .linkage = linkage });
497 @export(__aeabi_memmove, .{ .name = "__aeabi_memmove4", .linkage = linkage });
498 @export(__aeabi_memmove, .{ .name = "__aeabi_memmove8", .linkage = linkage });
499
500 const __aeabi_memset = @import("compiler_rt/arm.zig").__aeabi_memset;
501 @export(__aeabi_memset, .{ .name = "__aeabi_memset", .linkage = linkage });
502 @export(__aeabi_memset, .{ .name = "__aeabi_memset4", .linkage = linkage });
503 @export(__aeabi_memset, .{ .name = "__aeabi_memset8", .linkage = linkage });
504
505 const __aeabi_memclr = @import("compiler_rt/arm.zig").__aeabi_memclr;
506 @export(__aeabi_memclr, .{ .name = "__aeabi_memclr", .linkage = linkage });
507 @export(__aeabi_memclr, .{ .name = "__aeabi_memclr4", .linkage = linkage });
508 @export(__aeabi_memclr, .{ .name = "__aeabi_memclr8", .linkage = linkage });
509
510 if (os_tag == .linux) {
511 const __aeabi_read_tp = @import("compiler_rt/arm.zig").__aeabi_read_tp;
512 @export(__aeabi_read_tp, .{ .name = "__aeabi_read_tp", .linkage = linkage });
513 }
514
515 const __aeabi_f2d = @import("compiler_rt/extendXfYf2.zig").__aeabi_f2d;
516 @export(__aeabi_f2d, .{ .name = "__aeabi_f2d", .linkage = linkage });
517 const __aeabi_i2d = @import("compiler_rt/floatsiXf.zig").__aeabi_i2d;
518 @export(__aeabi_i2d, .{ .name = "__aeabi_i2d", .linkage = linkage });
519 const __aeabi_l2d = @import("compiler_rt/floatdidf.zig").__aeabi_l2d;
520 @export(__aeabi_l2d, .{ .name = "__aeabi_l2d", .linkage = linkage });
521 const __aeabi_l2f = @import("compiler_rt/floatXisf.zig").__aeabi_l2f;
522 @export(__aeabi_l2f, .{ .name = "__aeabi_l2f", .linkage = linkage });
523 const __aeabi_ui2d = @import("compiler_rt/floatunsidf.zig").__aeabi_ui2d;
524 @export(__aeabi_ui2d, .{ .name = "__aeabi_ui2d", .linkage = linkage });
525 const __aeabi_ul2d = @import("compiler_rt/floatundidf.zig").__aeabi_ul2d;
526 @export(__aeabi_ul2d, .{ .name = "__aeabi_ul2d", .linkage = linkage });
527 const __aeabi_ui2f = @import("compiler_rt/floatunsisf.zig").__aeabi_ui2f;
528 @export(__aeabi_ui2f, .{ .name = "__aeabi_ui2f", .linkage = linkage });
529 const __aeabi_ul2f = @import("compiler_rt/floatundisf.zig").__aeabi_ul2f;
530 @export(__aeabi_ul2f, .{ .name = "__aeabi_ul2f", .linkage = linkage });
531
532 const __aeabi_fneg = @import("compiler_rt/negXf2.zig").__aeabi_fneg;
533 @export(__aeabi_fneg, .{ .name = "__aeabi_fneg", .linkage = linkage });
534 const __aeabi_dneg = @import("compiler_rt/negXf2.zig").__aeabi_dneg;
535 @export(__aeabi_dneg, .{ .name = "__aeabi_dneg", .linkage = linkage });
536
537 const __aeabi_fmul = @import("compiler_rt/mulXf3.zig").__aeabi_fmul;
538 @export(__aeabi_fmul, .{ .name = "__aeabi_fmul", .linkage = linkage });
539 const __aeabi_dmul = @import("compiler_rt/mulXf3.zig").__aeabi_dmul;
540 @export(__aeabi_dmul, .{ .name = "__aeabi_dmul", .linkage = linkage });
541
542 const __aeabi_d2h = @import("compiler_rt/truncXfYf2.zig").__aeabi_d2h;
543 @export(__aeabi_d2h, .{ .name = "__aeabi_d2h", .linkage = linkage });
544
545 const __aeabi_f2ulz = @import("compiler_rt/fixunssfdi.zig").__aeabi_f2ulz;
546 @export(__aeabi_f2ulz, .{ .name = "__aeabi_f2ulz", .linkage = linkage });
547 const __aeabi_d2ulz = @import("compiler_rt/fixunsdfdi.zig").__aeabi_d2ulz;
548 @export(__aeabi_d2ulz, .{ .name = "__aeabi_d2ulz", .linkage = linkage });
549
550 const __aeabi_f2lz = @import("compiler_rt/fixsfdi.zig").__aeabi_f2lz;
551 @export(__aeabi_f2lz, .{ .name = "__aeabi_f2lz", .linkage = linkage });
552 const __aeabi_d2lz = @import("compiler_rt/fixdfdi.zig").__aeabi_d2lz;
553 @export(__aeabi_d2lz, .{ .name = "__aeabi_d2lz", .linkage = linkage });
554
555 const __aeabi_d2uiz = @import("compiler_rt/fixunsdfsi.zig").__aeabi_d2uiz;
556 @export(__aeabi_d2uiz, .{ .name = "__aeabi_d2uiz", .linkage = linkage });
557
558 const __aeabi_h2f = @import("compiler_rt/extendXfYf2.zig").__aeabi_h2f;
559 @export(__aeabi_h2f, .{ .name = "__aeabi_h2f", .linkage = linkage });
560 const __aeabi_f2h = @import("compiler_rt/truncXfYf2.zig").__aeabi_f2h;
561 @export(__aeabi_f2h, .{ .name = "__aeabi_f2h", .linkage = linkage });
562
563 const __aeabi_i2f = @import("compiler_rt/floatsiXf.zig").__aeabi_i2f;
564 @export(__aeabi_i2f, .{ .name = "__aeabi_i2f", .linkage = linkage });
565 const __aeabi_d2f = @import("compiler_rt/truncXfYf2.zig").__aeabi_d2f;
566 @export(__aeabi_d2f, .{ .name = "__aeabi_d2f", .linkage = linkage });
567
568 const __aeabi_fadd = @import("compiler_rt/addXf3.zig").__aeabi_fadd;
569 @export(__aeabi_fadd, .{ .name = "__aeabi_fadd", .linkage = linkage });
570 const __aeabi_dadd = @import("compiler_rt/addXf3.zig").__aeabi_dadd;
571 @export(__aeabi_dadd, .{ .name = "__aeabi_dadd", .linkage = linkage });
572 const __aeabi_fsub = @import("compiler_rt/addXf3.zig").__aeabi_fsub;
573 @export(__aeabi_fsub, .{ .name = "__aeabi_fsub", .linkage = linkage });
574 const __aeabi_dsub = @import("compiler_rt/addXf3.zig").__aeabi_dsub;
575 @export(__aeabi_dsub, .{ .name = "__aeabi_dsub", .linkage = linkage });
576
577 const __aeabi_f2uiz = @import("compiler_rt/fixunssfsi.zig").__aeabi_f2uiz;
578 @export(__aeabi_f2uiz, .{ .name = "__aeabi_f2uiz", .linkage = linkage });
579
580 const __aeabi_f2iz = @import("compiler_rt/fixsfsi.zig").__aeabi_f2iz;
581 @export(__aeabi_f2iz, .{ .name = "__aeabi_f2iz", .linkage = linkage });
582 const __aeabi_d2iz = @import("compiler_rt/fixdfsi.zig").__aeabi_d2iz;
583 @export(__aeabi_d2iz, .{ .name = "__aeabi_d2iz", .linkage = linkage });
584
585 const __aeabi_fdiv = @import("compiler_rt/divsf3.zig").__aeabi_fdiv;
586 @export(__aeabi_fdiv, .{ .name = "__aeabi_fdiv", .linkage = linkage });
587 const __aeabi_ddiv = @import("compiler_rt/divdf3.zig").__aeabi_ddiv;
588 @export(__aeabi_ddiv, .{ .name = "__aeabi_ddiv", .linkage = linkage });
589
590 const __aeabi_llsl = @import("compiler_rt/shift.zig").__aeabi_llsl;
591 @export(__aeabi_llsl, .{ .name = "__aeabi_llsl", .linkage = linkage });
592 const __aeabi_lasr = @import("compiler_rt/shift.zig").__aeabi_lasr;
593 @export(__aeabi_lasr, .{ .name = "__aeabi_lasr", .linkage = linkage });
594 const __aeabi_llsr = @import("compiler_rt/shift.zig").__aeabi_llsr;
595 @export(__aeabi_llsr, .{ .name = "__aeabi_llsr", .linkage = linkage });
596
597 const __aeabi_fcmpeq = @import("compiler_rt/compareXf2.zig").__aeabi_fcmpeq;
598 @export(__aeabi_fcmpeq, .{ .name = "__aeabi_fcmpeq", .linkage = linkage });
599 const __aeabi_fcmplt = @import("compiler_rt/compareXf2.zig").__aeabi_fcmplt;
600 @export(__aeabi_fcmplt, .{ .name = "__aeabi_fcmplt", .linkage = linkage });
601 const __aeabi_fcmple = @import("compiler_rt/compareXf2.zig").__aeabi_fcmple;
602 @export(__aeabi_fcmple, .{ .name = "__aeabi_fcmple", .linkage = linkage });
603 const __aeabi_fcmpge = @import("compiler_rt/compareXf2.zig").__aeabi_fcmpge;
604 @export(__aeabi_fcmpge, .{ .name = "__aeabi_fcmpge", .linkage = linkage });
605 const __aeabi_fcmpgt = @import("compiler_rt/compareXf2.zig").__aeabi_fcmpgt;
606 @export(__aeabi_fcmpgt, .{ .name = "__aeabi_fcmpgt", .linkage = linkage });
607 const __aeabi_fcmpun = @import("compiler_rt/compareXf2.zig").__aeabi_fcmpun;
608 @export(__aeabi_fcmpun, .{ .name = "__aeabi_fcmpun", .linkage = linkage });
609
610 const __aeabi_dcmpeq = @import("compiler_rt/compareXf2.zig").__aeabi_dcmpeq;
611 @export(__aeabi_dcmpeq, .{ .name = "__aeabi_dcmpeq", .linkage = linkage });
612 const __aeabi_dcmplt = @import("compiler_rt/compareXf2.zig").__aeabi_dcmplt;
613 @export(__aeabi_dcmplt, .{ .name = "__aeabi_dcmplt", .linkage = linkage });
614 const __aeabi_dcmple = @import("compiler_rt/compareXf2.zig").__aeabi_dcmple;
615 @export(__aeabi_dcmple, .{ .name = "__aeabi_dcmple", .linkage = linkage });
616 const __aeabi_dcmpge = @import("compiler_rt/compareXf2.zig").__aeabi_dcmpge;
617 @export(__aeabi_dcmpge, .{ .name = "__aeabi_dcmpge", .linkage = linkage });
618 const __aeabi_dcmpgt = @import("compiler_rt/compareXf2.zig").__aeabi_dcmpgt;
619 @export(__aeabi_dcmpgt, .{ .name = "__aeabi_dcmpgt", .linkage = linkage });
620 const __aeabi_dcmpun = @import("compiler_rt/compareXf2.zig").__aeabi_dcmpun;
621 @export(__aeabi_dcmpun, .{ .name = "__aeabi_dcmpun", .linkage = linkage });
480 if ((arch.isARM() or arch.isThumb()) and !is_test) {
481 const __aeabi_unwind_cpp_pr0 = @import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr0;
482 @export(__aeabi_unwind_cpp_pr0, .{ .name = "__aeabi_unwind_cpp_pr0", .linkage = linkage });
483 const __aeabi_unwind_cpp_pr1 = @import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr1;
484 @export(__aeabi_unwind_cpp_pr1, .{ .name = "__aeabi_unwind_cpp_pr1", .linkage = linkage });
485 const __aeabi_unwind_cpp_pr2 = @import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr2;
486 @export(__aeabi_unwind_cpp_pr2, .{ .name = "__aeabi_unwind_cpp_pr2", .linkage = linkage });
487
488 @export(__muldi3, .{ .name = "__aeabi_lmul", .linkage = linkage });
489
490 const __aeabi_ldivmod = @import("compiler_rt/arm.zig").__aeabi_ldivmod;
491 @export(__aeabi_ldivmod, .{ .name = "__aeabi_ldivmod", .linkage = linkage });
492 const __aeabi_uldivmod = @import("compiler_rt/arm.zig").__aeabi_uldivmod;
493 @export(__aeabi_uldivmod, .{ .name = "__aeabi_uldivmod", .linkage = linkage });
494
495 @export(__divsi3, .{ .name = "__aeabi_idiv", .linkage = linkage });
496 const __aeabi_idivmod = @import("compiler_rt/arm.zig").__aeabi_idivmod;
497 @export(__aeabi_idivmod, .{ .name = "__aeabi_idivmod", .linkage = linkage });
498 @export(__udivsi3, .{ .name = "__aeabi_uidiv", .linkage = linkage });
499 const __aeabi_uidivmod = @import("compiler_rt/arm.zig").__aeabi_uidivmod;
500 @export(__aeabi_uidivmod, .{ .name = "__aeabi_uidivmod", .linkage = linkage });
501
502 const __aeabi_memcpy = @import("compiler_rt/arm.zig").__aeabi_memcpy;
503 @export(__aeabi_memcpy, .{ .name = "__aeabi_memcpy", .linkage = linkage });
504 @export(__aeabi_memcpy, .{ .name = "__aeabi_memcpy4", .linkage = linkage });
505 @export(__aeabi_memcpy, .{ .name = "__aeabi_memcpy8", .linkage = linkage });
506
507 const __aeabi_memmove = @import("compiler_rt/arm.zig").__aeabi_memmove;
508 @export(__aeabi_memmove, .{ .name = "__aeabi_memmove", .linkage = linkage });
509 @export(__aeabi_memmove, .{ .name = "__aeabi_memmove4", .linkage = linkage });
510 @export(__aeabi_memmove, .{ .name = "__aeabi_memmove8", .linkage = linkage });
511
512 const __aeabi_memset = @import("compiler_rt/arm.zig").__aeabi_memset;
513 @export(__aeabi_memset, .{ .name = "__aeabi_memset", .linkage = linkage });
514 @export(__aeabi_memset, .{ .name = "__aeabi_memset4", .linkage = linkage });
515 @export(__aeabi_memset, .{ .name = "__aeabi_memset8", .linkage = linkage });
516
517 const __aeabi_memclr = @import("compiler_rt/arm.zig").__aeabi_memclr;
518 @export(__aeabi_memclr, .{ .name = "__aeabi_memclr", .linkage = linkage });
519 @export(__aeabi_memclr, .{ .name = "__aeabi_memclr4", .linkage = linkage });
520 @export(__aeabi_memclr, .{ .name = "__aeabi_memclr8", .linkage = linkage });
521
522 if (os_tag == .linux) {
523 const __aeabi_read_tp = @import("compiler_rt/arm.zig").__aeabi_read_tp;
524 @export(__aeabi_read_tp, .{ .name = "__aeabi_read_tp", .linkage = linkage });
622525 }
623526
624 if (arch == .i386 and abi == .msvc) {
625 // Don't let LLVM apply the stdcall name mangling on those MSVC builtins
626 const _alldiv = @import("compiler_rt/aulldiv.zig")._alldiv;
627 @export(_alldiv, .{ .name = "\x01__alldiv", .linkage = strong_linkage });
628 const _aulldiv = @import("compiler_rt/aulldiv.zig")._aulldiv;
629 @export(_aulldiv, .{ .name = "\x01__aulldiv", .linkage = strong_linkage });
630 const _allrem = @import("compiler_rt/aullrem.zig")._allrem;
631 @export(_allrem, .{ .name = "\x01__allrem", .linkage = strong_linkage });
632 const _aullrem = @import("compiler_rt/aullrem.zig")._aullrem;
633 @export(_aullrem, .{ .name = "\x01__aullrem", .linkage = strong_linkage });
634 }
527 const __aeabi_f2d = @import("compiler_rt/extendXfYf2.zig").__aeabi_f2d;
528 @export(__aeabi_f2d, .{ .name = "__aeabi_f2d", .linkage = linkage });
529 const __aeabi_i2d = @import("compiler_rt/floatsiXf.zig").__aeabi_i2d;
530 @export(__aeabi_i2d, .{ .name = "__aeabi_i2d", .linkage = linkage });
531 const __aeabi_l2d = @import("compiler_rt/floatdidf.zig").__aeabi_l2d;
532 @export(__aeabi_l2d, .{ .name = "__aeabi_l2d", .linkage = linkage });
533 const __aeabi_l2f = @import("compiler_rt/floatXisf.zig").__aeabi_l2f;
534 @export(__aeabi_l2f, .{ .name = "__aeabi_l2f", .linkage = linkage });
535 const __aeabi_ui2d = @import("compiler_rt/floatunsidf.zig").__aeabi_ui2d;
536 @export(__aeabi_ui2d, .{ .name = "__aeabi_ui2d", .linkage = linkage });
537 const __aeabi_ul2d = @import("compiler_rt/floatundidf.zig").__aeabi_ul2d;
538 @export(__aeabi_ul2d, .{ .name = "__aeabi_ul2d", .linkage = linkage });
539 const __aeabi_ui2f = @import("compiler_rt/floatunsisf.zig").__aeabi_ui2f;
540 @export(__aeabi_ui2f, .{ .name = "__aeabi_ui2f", .linkage = linkage });
541 const __aeabi_ul2f = @import("compiler_rt/floatundisf.zig").__aeabi_ul2f;
542 @export(__aeabi_ul2f, .{ .name = "__aeabi_ul2f", .linkage = linkage });
543
544 const __aeabi_fneg = @import("compiler_rt/negXf2.zig").__aeabi_fneg;
545 @export(__aeabi_fneg, .{ .name = "__aeabi_fneg", .linkage = linkage });
546 const __aeabi_dneg = @import("compiler_rt/negXf2.zig").__aeabi_dneg;
547 @export(__aeabi_dneg, .{ .name = "__aeabi_dneg", .linkage = linkage });
548
549 const __aeabi_fmul = @import("compiler_rt/mulXf3.zig").__aeabi_fmul;
550 @export(__aeabi_fmul, .{ .name = "__aeabi_fmul", .linkage = linkage });
551 const __aeabi_dmul = @import("compiler_rt/mulXf3.zig").__aeabi_dmul;
552 @export(__aeabi_dmul, .{ .name = "__aeabi_dmul", .linkage = linkage });
553
554 const __aeabi_d2h = @import("compiler_rt/truncXfYf2.zig").__aeabi_d2h;
555 @export(__aeabi_d2h, .{ .name = "__aeabi_d2h", .linkage = linkage });
556
557 const __aeabi_f2ulz = @import("compiler_rt/fixunssfdi.zig").__aeabi_f2ulz;
558 @export(__aeabi_f2ulz, .{ .name = "__aeabi_f2ulz", .linkage = linkage });
559 const __aeabi_d2ulz = @import("compiler_rt/fixunsdfdi.zig").__aeabi_d2ulz;
560 @export(__aeabi_d2ulz, .{ .name = "__aeabi_d2ulz", .linkage = linkage });
561
562 const __aeabi_f2lz = @import("compiler_rt/fixsfdi.zig").__aeabi_f2lz;
563 @export(__aeabi_f2lz, .{ .name = "__aeabi_f2lz", .linkage = linkage });
564 const __aeabi_d2lz = @import("compiler_rt/fixdfdi.zig").__aeabi_d2lz;
565 @export(__aeabi_d2lz, .{ .name = "__aeabi_d2lz", .linkage = linkage });
566
567 const __aeabi_d2uiz = @import("compiler_rt/fixunsdfsi.zig").__aeabi_d2uiz;
568 @export(__aeabi_d2uiz, .{ .name = "__aeabi_d2uiz", .linkage = linkage });
569
570 const __aeabi_h2f = @import("compiler_rt/extendXfYf2.zig").__aeabi_h2f;
571 @export(__aeabi_h2f, .{ .name = "__aeabi_h2f", .linkage = linkage });
572 const __aeabi_f2h = @import("compiler_rt/truncXfYf2.zig").__aeabi_f2h;
573 @export(__aeabi_f2h, .{ .name = "__aeabi_f2h", .linkage = linkage });
574
575 const __aeabi_i2f = @import("compiler_rt/floatsiXf.zig").__aeabi_i2f;
576 @export(__aeabi_i2f, .{ .name = "__aeabi_i2f", .linkage = linkage });
577 const __aeabi_d2f = @import("compiler_rt/truncXfYf2.zig").__aeabi_d2f;
578 @export(__aeabi_d2f, .{ .name = "__aeabi_d2f", .linkage = linkage });
579
580 const __aeabi_fadd = @import("compiler_rt/addXf3.zig").__aeabi_fadd;
581 @export(__aeabi_fadd, .{ .name = "__aeabi_fadd", .linkage = linkage });
582 const __aeabi_dadd = @import("compiler_rt/addXf3.zig").__aeabi_dadd;
583 @export(__aeabi_dadd, .{ .name = "__aeabi_dadd", .linkage = linkage });
584 const __aeabi_fsub = @import("compiler_rt/addXf3.zig").__aeabi_fsub;
585 @export(__aeabi_fsub, .{ .name = "__aeabi_fsub", .linkage = linkage });
586 const __aeabi_dsub = @import("compiler_rt/addXf3.zig").__aeabi_dsub;
587 @export(__aeabi_dsub, .{ .name = "__aeabi_dsub", .linkage = linkage });
588
589 const __aeabi_f2uiz = @import("compiler_rt/fixunssfsi.zig").__aeabi_f2uiz;
590 @export(__aeabi_f2uiz, .{ .name = "__aeabi_f2uiz", .linkage = linkage });
591
592 const __aeabi_f2iz = @import("compiler_rt/fixsfsi.zig").__aeabi_f2iz;
593 @export(__aeabi_f2iz, .{ .name = "__aeabi_f2iz", .linkage = linkage });
594 const __aeabi_d2iz = @import("compiler_rt/fixdfsi.zig").__aeabi_d2iz;
595 @export(__aeabi_d2iz, .{ .name = "__aeabi_d2iz", .linkage = linkage });
596
597 const __aeabi_fdiv = @import("compiler_rt/divsf3.zig").__aeabi_fdiv;
598 @export(__aeabi_fdiv, .{ .name = "__aeabi_fdiv", .linkage = linkage });
599 const __aeabi_ddiv = @import("compiler_rt/divdf3.zig").__aeabi_ddiv;
600 @export(__aeabi_ddiv, .{ .name = "__aeabi_ddiv", .linkage = linkage });
601
602 const __aeabi_llsl = @import("compiler_rt/shift.zig").__aeabi_llsl;
603 @export(__aeabi_llsl, .{ .name = "__aeabi_llsl", .linkage = linkage });
604 const __aeabi_lasr = @import("compiler_rt/shift.zig").__aeabi_lasr;
605 @export(__aeabi_lasr, .{ .name = "__aeabi_lasr", .linkage = linkage });
606 const __aeabi_llsr = @import("compiler_rt/shift.zig").__aeabi_llsr;
607 @export(__aeabi_llsr, .{ .name = "__aeabi_llsr", .linkage = linkage });
608
609 const __aeabi_fcmpeq = @import("compiler_rt/compareXf2.zig").__aeabi_fcmpeq;
610 @export(__aeabi_fcmpeq, .{ .name = "__aeabi_fcmpeq", .linkage = linkage });
611 const __aeabi_fcmplt = @import("compiler_rt/compareXf2.zig").__aeabi_fcmplt;
612 @export(__aeabi_fcmplt, .{ .name = "__aeabi_fcmplt", .linkage = linkage });
613 const __aeabi_fcmple = @import("compiler_rt/compareXf2.zig").__aeabi_fcmple;
614 @export(__aeabi_fcmple, .{ .name = "__aeabi_fcmple", .linkage = linkage });
615 const __aeabi_fcmpge = @import("compiler_rt/compareXf2.zig").__aeabi_fcmpge;
616 @export(__aeabi_fcmpge, .{ .name = "__aeabi_fcmpge", .linkage = linkage });
617 const __aeabi_fcmpgt = @import("compiler_rt/compareXf2.zig").__aeabi_fcmpgt;
618 @export(__aeabi_fcmpgt, .{ .name = "__aeabi_fcmpgt", .linkage = linkage });
619 const __aeabi_fcmpun = @import("compiler_rt/compareXf2.zig").__aeabi_fcmpun;
620 @export(__aeabi_fcmpun, .{ .name = "__aeabi_fcmpun", .linkage = linkage });
621
622 const __aeabi_dcmpeq = @import("compiler_rt/compareXf2.zig").__aeabi_dcmpeq;
623 @export(__aeabi_dcmpeq, .{ .name = "__aeabi_dcmpeq", .linkage = linkage });
624 const __aeabi_dcmplt = @import("compiler_rt/compareXf2.zig").__aeabi_dcmplt;
625 @export(__aeabi_dcmplt, .{ .name = "__aeabi_dcmplt", .linkage = linkage });
626 const __aeabi_dcmple = @import("compiler_rt/compareXf2.zig").__aeabi_dcmple;
627 @export(__aeabi_dcmple, .{ .name = "__aeabi_dcmple", .linkage = linkage });
628 const __aeabi_dcmpge = @import("compiler_rt/compareXf2.zig").__aeabi_dcmpge;
629 @export(__aeabi_dcmpge, .{ .name = "__aeabi_dcmpge", .linkage = linkage });
630 const __aeabi_dcmpgt = @import("compiler_rt/compareXf2.zig").__aeabi_dcmpgt;
631 @export(__aeabi_dcmpgt, .{ .name = "__aeabi_dcmpgt", .linkage = linkage });
632 const __aeabi_dcmpun = @import("compiler_rt/compareXf2.zig").__aeabi_dcmpun;
633 @export(__aeabi_dcmpun, .{ .name = "__aeabi_dcmpun", .linkage = linkage });
634 }
635635
636 if (arch.isSPARC()) {
637 // SPARC systems use a different naming scheme
638 const _Qp_add = @import("compiler_rt/sparc.zig")._Qp_add;
639 @export(_Qp_add, .{ .name = "_Qp_add", .linkage = linkage });
640 const _Qp_div = @import("compiler_rt/sparc.zig")._Qp_div;
641 @export(_Qp_div, .{ .name = "_Qp_div", .linkage = linkage });
642 const _Qp_mul = @import("compiler_rt/sparc.zig")._Qp_mul;
643 @export(_Qp_mul, .{ .name = "_Qp_mul", .linkage = linkage });
644 const _Qp_sub = @import("compiler_rt/sparc.zig")._Qp_sub;
645 @export(_Qp_sub, .{ .name = "_Qp_sub", .linkage = linkage });
646
647 const _Qp_cmp = @import("compiler_rt/sparc.zig")._Qp_cmp;
648 @export(_Qp_cmp, .{ .name = "_Qp_cmp", .linkage = linkage });
649 const _Qp_feq = @import("compiler_rt/sparc.zig")._Qp_feq;
650 @export(_Qp_feq, .{ .name = "_Qp_feq", .linkage = linkage });
651 const _Qp_fne = @import("compiler_rt/sparc.zig")._Qp_fne;
652 @export(_Qp_fne, .{ .name = "_Qp_fne", .linkage = linkage });
653 const _Qp_flt = @import("compiler_rt/sparc.zig")._Qp_flt;
654 @export(_Qp_flt, .{ .name = "_Qp_flt", .linkage = linkage });
655 const _Qp_fle = @import("compiler_rt/sparc.zig")._Qp_fle;
656 @export(_Qp_fle, .{ .name = "_Qp_fle", .linkage = linkage });
657 const _Qp_fgt = @import("compiler_rt/sparc.zig")._Qp_fgt;
658 @export(_Qp_fgt, .{ .name = "_Qp_fgt", .linkage = linkage });
659 const _Qp_fge = @import("compiler_rt/sparc.zig")._Qp_fge;
660 @export(_Qp_fge, .{ .name = "_Qp_fge", .linkage = linkage });
661
662 const _Qp_itoq = @import("compiler_rt/sparc.zig")._Qp_itoq;
663 @export(_Qp_itoq, .{ .name = "_Qp_itoq", .linkage = linkage });
664 const _Qp_uitoq = @import("compiler_rt/sparc.zig")._Qp_uitoq;
665 @export(_Qp_uitoq, .{ .name = "_Qp_uitoq", .linkage = linkage });
666 const _Qp_xtoq = @import("compiler_rt/sparc.zig")._Qp_xtoq;
667 @export(_Qp_xtoq, .{ .name = "_Qp_xtoq", .linkage = linkage });
668 const _Qp_uxtoq = @import("compiler_rt/sparc.zig")._Qp_uxtoq;
669 @export(_Qp_uxtoq, .{ .name = "_Qp_uxtoq", .linkage = linkage });
670 const _Qp_stoq = @import("compiler_rt/sparc.zig")._Qp_stoq;
671 @export(_Qp_stoq, .{ .name = "_Qp_stoq", .linkage = linkage });
672 const _Qp_dtoq = @import("compiler_rt/sparc.zig")._Qp_dtoq;
673 @export(_Qp_dtoq, .{ .name = "_Qp_dtoq", .linkage = linkage });
674 const _Qp_qtoi = @import("compiler_rt/sparc.zig")._Qp_qtoi;
675 @export(_Qp_qtoi, .{ .name = "_Qp_qtoi", .linkage = linkage });
676 const _Qp_qtoui = @import("compiler_rt/sparc.zig")._Qp_qtoui;
677 @export(_Qp_qtoui, .{ .name = "_Qp_qtoui", .linkage = linkage });
678 const _Qp_qtox = @import("compiler_rt/sparc.zig")._Qp_qtox;
679 @export(_Qp_qtox, .{ .name = "_Qp_qtox", .linkage = linkage });
680 const _Qp_qtoux = @import("compiler_rt/sparc.zig")._Qp_qtoux;
681 @export(_Qp_qtoux, .{ .name = "_Qp_qtoux", .linkage = linkage });
682 const _Qp_qtos = @import("compiler_rt/sparc.zig")._Qp_qtos;
683 @export(_Qp_qtos, .{ .name = "_Qp_qtos", .linkage = linkage });
684 const _Qp_qtod = @import("compiler_rt/sparc.zig")._Qp_qtod;
685 @export(_Qp_qtod, .{ .name = "_Qp_qtod", .linkage = linkage });
686 }
636 if (arch == .i386 and abi == .msvc) {
637 // Don't let LLVM apply the stdcall name mangling on those MSVC builtins
638 const _alldiv = @import("compiler_rt/aulldiv.zig")._alldiv;
639 @export(_alldiv, .{ .name = "\x01__alldiv", .linkage = strong_linkage });
640 const _aulldiv = @import("compiler_rt/aulldiv.zig")._aulldiv;
641 @export(_aulldiv, .{ .name = "\x01__aulldiv", .linkage = strong_linkage });
642 const _allrem = @import("compiler_rt/aullrem.zig")._allrem;
643 @export(_allrem, .{ .name = "\x01__allrem", .linkage = strong_linkage });
644 const _aullrem = @import("compiler_rt/aullrem.zig")._aullrem;
645 @export(_aullrem, .{ .name = "\x01__aullrem", .linkage = strong_linkage });
646 }
687647
688 if ((arch == .powerpc or arch.isPPC64()) and !is_test) {
689 @export(__addtf3, .{ .name = "__addkf3", .linkage = linkage });
690 @export(__subtf3, .{ .name = "__subkf3", .linkage = linkage });
691 @export(__multf3, .{ .name = "__mulkf3", .linkage = linkage });
692 @export(__divtf3, .{ .name = "__divkf3", .linkage = linkage });
693 @export(__extendsftf2, .{ .name = "__extendsfkf2", .linkage = linkage });
694 @export(__extenddftf2, .{ .name = "__extenddfkf2", .linkage = linkage });
695 @export(__trunctfsf2, .{ .name = "__trunckfsf2", .linkage = linkage });
696 @export(__trunctfdf2, .{ .name = "__trunckfdf2", .linkage = linkage });
697 @export(__fixtfdi, .{ .name = "__fixkfdi", .linkage = linkage });
698 @export(__fixtfsi, .{ .name = "__fixkfsi", .linkage = linkage });
699 @export(__fixunstfsi, .{ .name = "__fixunskfsi", .linkage = linkage });
700 @export(__fixunstfdi, .{ .name = "__fixunskfdi", .linkage = linkage });
701 @export(__floatsitf, .{ .name = "__floatsikf", .linkage = linkage });
702 @export(__floatditf, .{ .name = "__floatdikf", .linkage = linkage });
703 @export(__floatunditf, .{ .name = "__floatundikf", .linkage = linkage });
704 @export(__floatunsitf, .{ .name = "__floatunsikf", .linkage = linkage });
705
706 @export(__letf2, .{ .name = "__eqkf2", .linkage = linkage });
707 @export(__letf2, .{ .name = "__nekf2", .linkage = linkage });
708 @export(__getf2, .{ .name = "__gekf2", .linkage = linkage });
709 @export(__letf2, .{ .name = "__ltkf2", .linkage = linkage });
710 @export(__letf2, .{ .name = "__lekf2", .linkage = linkage });
711 @export(__getf2, .{ .name = "__gtkf2", .linkage = linkage });
712 @export(__unordtf2, .{ .name = "__unordkf2", .linkage = linkage });
713 }
648 if (arch.isSPARC()) {
649 // SPARC systems use a different naming scheme
650 const _Qp_add = @import("compiler_rt/sparc.zig")._Qp_add;
651 @export(_Qp_add, .{ .name = "_Qp_add", .linkage = linkage });
652 const _Qp_div = @import("compiler_rt/sparc.zig")._Qp_div;
653 @export(_Qp_div, .{ .name = "_Qp_div", .linkage = linkage });
654 const _Qp_mul = @import("compiler_rt/sparc.zig")._Qp_mul;
655 @export(_Qp_mul, .{ .name = "_Qp_mul", .linkage = linkage });
656 const _Qp_sub = @import("compiler_rt/sparc.zig")._Qp_sub;
657 @export(_Qp_sub, .{ .name = "_Qp_sub", .linkage = linkage });
658
659 const _Qp_cmp = @import("compiler_rt/sparc.zig")._Qp_cmp;
660 @export(_Qp_cmp, .{ .name = "_Qp_cmp", .linkage = linkage });
661 const _Qp_feq = @import("compiler_rt/sparc.zig")._Qp_feq;
662 @export(_Qp_feq, .{ .name = "_Qp_feq", .linkage = linkage });
663 const _Qp_fne = @import("compiler_rt/sparc.zig")._Qp_fne;
664 @export(_Qp_fne, .{ .name = "_Qp_fne", .linkage = linkage });
665 const _Qp_flt = @import("compiler_rt/sparc.zig")._Qp_flt;
666 @export(_Qp_flt, .{ .name = "_Qp_flt", .linkage = linkage });
667 const _Qp_fle = @import("compiler_rt/sparc.zig")._Qp_fle;
668 @export(_Qp_fle, .{ .name = "_Qp_fle", .linkage = linkage });
669 const _Qp_fgt = @import("compiler_rt/sparc.zig")._Qp_fgt;
670 @export(_Qp_fgt, .{ .name = "_Qp_fgt", .linkage = linkage });
671 const _Qp_fge = @import("compiler_rt/sparc.zig")._Qp_fge;
672 @export(_Qp_fge, .{ .name = "_Qp_fge", .linkage = linkage });
673
674 const _Qp_itoq = @import("compiler_rt/sparc.zig")._Qp_itoq;
675 @export(_Qp_itoq, .{ .name = "_Qp_itoq", .linkage = linkage });
676 const _Qp_uitoq = @import("compiler_rt/sparc.zig")._Qp_uitoq;
677 @export(_Qp_uitoq, .{ .name = "_Qp_uitoq", .linkage = linkage });
678 const _Qp_xtoq = @import("compiler_rt/sparc.zig")._Qp_xtoq;
679 @export(_Qp_xtoq, .{ .name = "_Qp_xtoq", .linkage = linkage });
680 const _Qp_uxtoq = @import("compiler_rt/sparc.zig")._Qp_uxtoq;
681 @export(_Qp_uxtoq, .{ .name = "_Qp_uxtoq", .linkage = linkage });
682 const _Qp_stoq = @import("compiler_rt/sparc.zig")._Qp_stoq;
683 @export(_Qp_stoq, .{ .name = "_Qp_stoq", .linkage = linkage });
684 const _Qp_dtoq = @import("compiler_rt/sparc.zig")._Qp_dtoq;
685 @export(_Qp_dtoq, .{ .name = "_Qp_dtoq", .linkage = linkage });
686 const _Qp_qtoi = @import("compiler_rt/sparc.zig")._Qp_qtoi;
687 @export(_Qp_qtoi, .{ .name = "_Qp_qtoi", .linkage = linkage });
688 const _Qp_qtoui = @import("compiler_rt/sparc.zig")._Qp_qtoui;
689 @export(_Qp_qtoui, .{ .name = "_Qp_qtoui", .linkage = linkage });
690 const _Qp_qtox = @import("compiler_rt/sparc.zig")._Qp_qtox;
691 @export(_Qp_qtox, .{ .name = "_Qp_qtox", .linkage = linkage });
692 const _Qp_qtoux = @import("compiler_rt/sparc.zig")._Qp_qtoux;
693 @export(_Qp_qtoux, .{ .name = "_Qp_qtoux", .linkage = linkage });
694 const _Qp_qtos = @import("compiler_rt/sparc.zig")._Qp_qtos;
695 @export(_Qp_qtos, .{ .name = "_Qp_qtos", .linkage = linkage });
696 const _Qp_qtod = @import("compiler_rt/sparc.zig")._Qp_qtod;
697 @export(_Qp_qtod, .{ .name = "_Qp_qtod", .linkage = linkage });
698 }
714699
715 _ = @import("compiler_rt/atomics.zig");
700 if ((arch == .powerpc or arch.isPPC64()) and !is_test) {
701 @export(__addtf3, .{ .name = "__addkf3", .linkage = linkage });
702 @export(__subtf3, .{ .name = "__subkf3", .linkage = linkage });
703 @export(__multf3, .{ .name = "__mulkf3", .linkage = linkage });
704 @export(__divtf3, .{ .name = "__divkf3", .linkage = linkage });
705 @export(__extendsftf2, .{ .name = "__extendsfkf2", .linkage = linkage });
706 @export(__extenddftf2, .{ .name = "__extenddfkf2", .linkage = linkage });
707 @export(__trunctfsf2, .{ .name = "__trunckfsf2", .linkage = linkage });
708 @export(__trunctfdf2, .{ .name = "__trunckfdf2", .linkage = linkage });
709 @export(__fixtfdi, .{ .name = "__fixkfdi", .linkage = linkage });
710 @export(__fixtfsi, .{ .name = "__fixkfsi", .linkage = linkage });
711 @export(__fixunstfsi, .{ .name = "__fixunskfsi", .linkage = linkage });
712 @export(__fixunstfdi, .{ .name = "__fixunskfdi", .linkage = linkage });
713 @export(__floatsitf, .{ .name = "__floatsikf", .linkage = linkage });
714 @export(__floatditf, .{ .name = "__floatdikf", .linkage = linkage });
715 @export(__floatunditf, .{ .name = "__floatundikf", .linkage = linkage });
716 @export(__floatunsitf, .{ .name = "__floatunsikf", .linkage = linkage });
717
718 @export(__letf2, .{ .name = "__eqkf2", .linkage = linkage });
719 @export(__letf2, .{ .name = "__nekf2", .linkage = linkage });
720 @export(__getf2, .{ .name = "__gekf2", .linkage = linkage });
721 @export(__letf2, .{ .name = "__ltkf2", .linkage = linkage });
722 @export(__letf2, .{ .name = "__lekf2", .linkage = linkage });
723 @export(__getf2, .{ .name = "__gtkf2", .linkage = linkage });
724 @export(__unordtf2, .{ .name = "__unordkf2", .linkage = linkage });
725 }
716726
727 @export(floorf, .{ .name = "floorf", .linkage = linkage });
728 @export(floor, .{ .name = "floor", .linkage = linkage });
729 @export(floorl, .{ .name = "floorl", .linkage = linkage });
730
731 if (!builtin.zig_is_stage2) {
717732 @export(fmaq, .{ .name = "fmaq", .linkage = linkage });
718 @export(floorf, .{ .name = "floorf", .linkage = linkage });
719 @export(floor, .{ .name = "floor", .linkage = linkage });
720 @export(floorl, .{ .name = "floorl", .linkage = linkage });
721733 }
722734}
723735
lib/std/special/compiler_rt/absv.zig+29-24
......@@ -2,31 +2,36 @@
22// * @panic, if value can not be represented
33// - absvXi4_generic for unoptimized version
44
5fn absvXi_generic(comptime ST: type) fn (a: ST) callconv(.C) ST {
6 return struct {
7 fn f(a: ST) callconv(.C) ST {
8 const UT = switch (ST) {
9 i32 => u32,
10 i64 => u64,
11 i128 => u128,
12 else => unreachable,
13 };
14 // taken from Bit Twiddling Hacks
15 // compute the integer absolute value (abs) without branching
16 var x: ST = a;
17 const N: UT = @bitSizeOf(ST);
18 const sign: ST = a >> N - 1;
19 x +%= sign;
20 x ^= sign;
21 if (x < 0)
22 @panic("compiler_rt absv: overflow");
23 return x;
24 }
25 }.f;
5inline fn absvXi(comptime ST: type, a: ST) ST {
6 const UT = switch (ST) {
7 i32 => u32,
8 i64 => u64,
9 i128 => u128,
10 else => unreachable,
11 };
12 // taken from Bit Twiddling Hacks
13 // compute the integer absolute value (abs) without branching
14 var x: ST = a;
15 const N: UT = @bitSizeOf(ST);
16 const sign: ST = a >> N - 1;
17 x +%= sign;
18 x ^= sign;
19 if (x < 0)
20 @panic("compiler_rt absv: overflow");
21 return x;
22}
23
24pub fn __absvsi2(a: i32) callconv(.C) i32 {
25 return absvXi(i32, a);
26}
27
28pub fn __absvdi2(a: i64) callconv(.C) i64 {
29 return absvXi(i64, a);
30}
31
32pub fn __absvti2(a: i128) callconv(.C) i128 {
33 return absvXi(i128, a);
2634}
27pub const __absvsi2 = absvXi_generic(i32);
28pub const __absvdi2 = absvXi_generic(i64);
29pub const __absvti2 = absvXi_generic(i128);
3035
3136test {
3237 _ = @import("absvsi2_test.zig");
lib/std/special/compiler_rt/atomics.zig+272-182
......@@ -131,213 +131,303 @@ comptime {
131131// Specialized versions of the GCC atomic builtin functions.
132132// LLVM emits those iff the object size is known and the pointers are correctly
133133// aligned.
134inline fn atomic_load_N(comptime T: type, src: *T, model: i32) T {
135 _ = model;
136 if (@sizeOf(T) > largest_atomic_size) {
137 var sl = spinlocks.get(@ptrToInt(src));
138 defer sl.release();
139 return src.*;
140 } else {
141 return @atomicLoad(T, src, .SeqCst);
142 }
143}
134144
135fn atomicLoadFn(comptime T: type) fn (*T, i32) callconv(.C) T {
136 return struct {
137 fn atomic_load_N(src: *T, model: i32) callconv(.C) T {
138 _ = model;
139 if (@sizeOf(T) > largest_atomic_size) {
140 var sl = spinlocks.get(@ptrToInt(src));
141 defer sl.release();
142 return src.*;
143 } else {
144 return @atomicLoad(T, src, .SeqCst);
145 }
146 }
147 }.atomic_load_N;
145fn __atomic_load_1(src: *u8, model: i32) callconv(.C) u8 {
146 return atomic_load_N(u8, src, model);
148147}
149148
150comptime {
151 if (supports_atomic_ops) {
152 const atomicLoad_u8 = atomicLoadFn(u8);
153 const atomicLoad_u16 = atomicLoadFn(u16);
154 const atomicLoad_u32 = atomicLoadFn(u32);
155 const atomicLoad_u64 = atomicLoadFn(u64);
156 @export(atomicLoad_u8, .{ .name = "__atomic_load_1", .linkage = linkage });
157 @export(atomicLoad_u16, .{ .name = "__atomic_load_2", .linkage = linkage });
158 @export(atomicLoad_u32, .{ .name = "__atomic_load_4", .linkage = linkage });
159 @export(atomicLoad_u64, .{ .name = "__atomic_load_8", .linkage = linkage });
160 }
149fn __atomic_load_2(src: *u16, model: i32) callconv(.C) u16 {
150 return atomic_load_N(u16, src, model);
161151}
162152
163fn atomicStoreFn(comptime T: type) fn (*T, T, i32) callconv(.C) void {
164 return struct {
165 fn atomic_store_N(dst: *T, value: T, model: i32) callconv(.C) void {
166 _ = model;
167 if (@sizeOf(T) > largest_atomic_size) {
168 var sl = spinlocks.get(@ptrToInt(dst));
169 defer sl.release();
170 dst.* = value;
171 } else {
172 @atomicStore(T, dst, value, .SeqCst);
173 }
174 }
175 }.atomic_store_N;
153fn __atomic_load_4(src: *u32, model: i32) callconv(.C) u32 {
154 return atomic_load_N(u32, src, model);
176155}
177156
178comptime {
179 if (supports_atomic_ops) {
180 const atomicStore_u8 = atomicStoreFn(u8);
181 const atomicStore_u16 = atomicStoreFn(u16);
182 const atomicStore_u32 = atomicStoreFn(u32);
183 const atomicStore_u64 = atomicStoreFn(u64);
184 @export(atomicStore_u8, .{ .name = "__atomic_store_1", .linkage = linkage });
185 @export(atomicStore_u16, .{ .name = "__atomic_store_2", .linkage = linkage });
186 @export(atomicStore_u32, .{ .name = "__atomic_store_4", .linkage = linkage });
187 @export(atomicStore_u64, .{ .name = "__atomic_store_8", .linkage = linkage });
157fn __atomic_load_8(src: *u64, model: i32) callconv(.C) u64 {
158 return atomic_load_N(u64, src, model);
159}
160
161inline fn atomic_store_N(comptime T: type, dst: *T, value: T, model: i32) void {
162 _ = model;
163 if (@sizeOf(T) > largest_atomic_size) {
164 var sl = spinlocks.get(@ptrToInt(dst));
165 defer sl.release();
166 dst.* = value;
167 } else {
168 @atomicStore(T, dst, value, .SeqCst);
188169 }
189170}
190171
191fn atomicExchangeFn(comptime T: type) fn (*T, T, i32) callconv(.C) T {
192 return struct {
193 fn atomic_exchange_N(ptr: *T, val: T, model: i32) callconv(.C) T {
194 _ = model;
195 if (@sizeOf(T) > largest_atomic_size) {
196 var sl = spinlocks.get(@ptrToInt(ptr));
197 defer sl.release();
198 const value = ptr.*;
199 ptr.* = val;
200 return value;
201 } else {
202 return @atomicRmw(T, ptr, .Xchg, val, .SeqCst);
203 }
204 }
205 }.atomic_exchange_N;
172fn __atomic_store_1(dst: *u8, value: u8, model: i32) callconv(.C) void {
173 return atomic_store_N(u8, dst, value, model);
206174}
207175
208comptime {
209 if (supports_atomic_ops) {
210 const atomicExchange_u8 = atomicExchangeFn(u8);
211 const atomicExchange_u16 = atomicExchangeFn(u16);
212 const atomicExchange_u32 = atomicExchangeFn(u32);
213 const atomicExchange_u64 = atomicExchangeFn(u64);
214 @export(atomicExchange_u8, .{ .name = "__atomic_exchange_1", .linkage = linkage });
215 @export(atomicExchange_u16, .{ .name = "__atomic_exchange_2", .linkage = linkage });
216 @export(atomicExchange_u32, .{ .name = "__atomic_exchange_4", .linkage = linkage });
217 @export(atomicExchange_u64, .{ .name = "__atomic_exchange_8", .linkage = linkage });
176fn __atomic_store_2(dst: *u16, value: u16, model: i32) callconv(.C) void {
177 return atomic_store_N(u16, dst, value, model);
178}
179
180fn __atomic_store_4(dst: *u32, value: u32, model: i32) callconv(.C) void {
181 return atomic_store_N(u32, dst, value, model);
182}
183
184fn __atomic_store_8(dst: *u64, value: u64, model: i32) callconv(.C) void {
185 return atomic_store_N(u64, dst, value, model);
186}
187
188inline fn atomic_exchange_N(comptime T: type, ptr: *T, val: T, model: i32) T {
189 _ = model;
190 if (@sizeOf(T) > largest_atomic_size) {
191 var sl = spinlocks.get(@ptrToInt(ptr));
192 defer sl.release();
193 const value = ptr.*;
194 ptr.* = val;
195 return value;
196 } else {
197 return @atomicRmw(T, ptr, .Xchg, val, .SeqCst);
218198 }
219199}
220200
221fn atomicCompareExchangeFn(comptime T: type) fn (*T, *T, T, i32, i32) callconv(.C) i32 {
222 return struct {
223 fn atomic_compare_exchange_N(ptr: *T, expected: *T, desired: T, success: i32, failure: i32) callconv(.C) i32 {
224 _ = success;
225 _ = failure;
226 if (@sizeOf(T) > largest_atomic_size) {
227 var sl = spinlocks.get(@ptrToInt(ptr));
228 defer sl.release();
229 const value = ptr.*;
230 if (value == expected.*) {
231 ptr.* = desired;
232 return 1;
233 }
234 expected.* = value;
235 return 0;
236 } else {
237 if (@cmpxchgStrong(T, ptr, expected.*, desired, .SeqCst, .SeqCst)) |old_value| {
238 expected.* = old_value;
239 return 0;
240 }
241 return 1;
242 }
201fn __atomic_exchange_1(ptr: *u8, val: u8, model: i32) callconv(.C) u8 {
202 return atomic_exchange_N(u8, ptr, val, model);
203}
204
205fn __atomic_exchange_2(ptr: *u16, val: u16, model: i32) callconv(.C) u16 {
206 return atomic_exchange_N(u16, ptr, val, model);
207}
208
209fn __atomic_exchange_4(ptr: *u32, val: u32, model: i32) callconv(.C) u32 {
210 return atomic_exchange_N(u32, ptr, val, model);
211}
212
213fn __atomic_exchange_8(ptr: *u64, val: u64, model: i32) callconv(.C) u64 {
214 return atomic_exchange_N(u64, ptr, val, model);
215}
216
217inline fn atomic_compare_exchange_N(
218 comptime T: type,
219 ptr: *T,
220 expected: *T,
221 desired: T,
222 success: i32,
223 failure: i32,
224) i32 {
225 _ = success;
226 _ = failure;
227 if (@sizeOf(T) > largest_atomic_size) {
228 var sl = spinlocks.get(@ptrToInt(ptr));
229 defer sl.release();
230 const value = ptr.*;
231 if (value == expected.*) {
232 ptr.* = desired;
233 return 1;
243234 }
244 }.atomic_compare_exchange_N;
235 expected.* = value;
236 return 0;
237 } else {
238 if (@cmpxchgStrong(T, ptr, expected.*, desired, .SeqCst, .SeqCst)) |old_value| {
239 expected.* = old_value;
240 return 0;
241 }
242 return 1;
243 }
245244}
246245
247comptime {
248 if (supports_atomic_ops) {
249 const atomicCompareExchange_u8 = atomicCompareExchangeFn(u8);
250 const atomicCompareExchange_u16 = atomicCompareExchangeFn(u16);
251 const atomicCompareExchange_u32 = atomicCompareExchangeFn(u32);
252 const atomicCompareExchange_u64 = atomicCompareExchangeFn(u64);
253 @export(atomicCompareExchange_u8, .{ .name = "__atomic_compare_exchange_1", .linkage = linkage });
254 @export(atomicCompareExchange_u16, .{ .name = "__atomic_compare_exchange_2", .linkage = linkage });
255 @export(atomicCompareExchange_u32, .{ .name = "__atomic_compare_exchange_4", .linkage = linkage });
256 @export(atomicCompareExchange_u64, .{ .name = "__atomic_compare_exchange_8", .linkage = linkage });
246fn __atomic_compare_exchange_1(ptr: *u8, expected: *u8, desired: u8, success: i32, failure: i32) callconv(.C) i32 {
247 return atomic_compare_exchange_N(u8, ptr, expected, desired, success, failure);
248}
249
250fn __atomic_compare_exchange_2(ptr: *u16, expected: *u16, desired: u16, success: i32, failure: i32) callconv(.C) i32 {
251 return atomic_compare_exchange_N(u16, ptr, expected, desired, success, failure);
252}
253
254fn __atomic_compare_exchange_4(ptr: *u32, expected: *u32, desired: u32, success: i32, failure: i32) callconv(.C) i32 {
255 return atomic_compare_exchange_N(u32, ptr, expected, desired, success, failure);
256}
257
258fn __atomic_compare_exchange_8(ptr: *u64, expected: *u64, desired: u64, success: i32, failure: i32) callconv(.C) i32 {
259 return atomic_compare_exchange_N(u64, ptr, expected, desired, success, failure);
260}
261
262inline fn fetch_op_N(comptime T: type, comptime op: std.builtin.AtomicRmwOp, ptr: *T, val: T, model: i32) T {
263 _ = model;
264 if (@sizeOf(T) > largest_atomic_size) {
265 var sl = spinlocks.get(@ptrToInt(ptr));
266 defer sl.release();
267
268 const value = ptr.*;
269 ptr.* = switch (op) {
270 .Add => value +% val,
271 .Sub => value -% val,
272 .And => value & val,
273 .Nand => ~(value & val),
274 .Or => value | val,
275 .Xor => value ^ val,
276 else => @compileError("unsupported atomic op"),
277 };
278
279 return value;
257280 }
281
282 return @atomicRmw(T, ptr, op, val, .SeqCst);
258283}
259284
260fn fetchFn(comptime T: type, comptime op: std.builtin.AtomicRmwOp) fn (*T, T, i32) callconv(.C) T {
261 return struct {
262 pub fn fetch_op_N(ptr: *T, val: T, model: i32) callconv(.C) T {
263 _ = model;
264 if (@sizeOf(T) > largest_atomic_size) {
265 var sl = spinlocks.get(@ptrToInt(ptr));
266 defer sl.release();
267
268 const value = ptr.*;
269 ptr.* = switch (op) {
270 .Add => value +% val,
271 .Sub => value -% val,
272 .And => value & val,
273 .Nand => ~(value & val),
274 .Or => value | val,
275 .Xor => value ^ val,
276 else => @compileError("unsupported atomic op"),
277 };
278
279 return value;
280 }
285fn __atomic_fetch_add_1(ptr: *u8, val: u8, model: i32) callconv(.C) u8 {
286 return fetch_op_N(u8, .Add, ptr, val, model);
287}
281288
282 return @atomicRmw(T, ptr, op, val, .SeqCst);
283 }
284 }.fetch_op_N;
289fn __atomic_fetch_add_2(ptr: *u16, val: u16, model: i32) callconv(.C) u16 {
290 return fetch_op_N(u16, .Add, ptr, val, model);
291}
292
293fn __atomic_fetch_add_4(ptr: *u32, val: u32, model: i32) callconv(.C) u32 {
294 return fetch_op_N(u32, .Add, ptr, val, model);
295}
296
297fn __atomic_fetch_add_8(ptr: *u64, val: u64, model: i32) callconv(.C) u64 {
298 return fetch_op_N(u64, .Add, ptr, val, model);
299}
300
301fn __atomic_fetch_sub_1(ptr: *u8, val: u8, model: i32) callconv(.C) u8 {
302 return fetch_op_N(u8, .Sub, ptr, val, model);
303}
304
305fn __atomic_fetch_sub_2(ptr: *u16, val: u16, model: i32) callconv(.C) u16 {
306 return fetch_op_N(u16, .Sub, ptr, val, model);
307}
308
309fn __atomic_fetch_sub_4(ptr: *u32, val: u32, model: i32) callconv(.C) u32 {
310 return fetch_op_N(u32, .Sub, ptr, val, model);
311}
312
313fn __atomic_fetch_sub_8(ptr: *u64, val: u64, model: i32) callconv(.C) u64 {
314 return fetch_op_N(u64, .Sub, ptr, val, model);
315}
316
317fn __atomic_fetch_and_1(ptr: *u8, val: u8, model: i32) callconv(.C) u8 {
318 return fetch_op_N(u8, .And, ptr, val, model);
319}
320
321fn __atomic_fetch_and_2(ptr: *u16, val: u16, model: i32) callconv(.C) u16 {
322 return fetch_op_N(u16, .And, ptr, val, model);
323}
324
325fn __atomic_fetch_and_4(ptr: *u32, val: u32, model: i32) callconv(.C) u32 {
326 return fetch_op_N(u32, .And, ptr, val, model);
327}
328
329fn __atomic_fetch_and_8(ptr: *u64, val: u64, model: i32) callconv(.C) u64 {
330 return fetch_op_N(u64, .And, ptr, val, model);
331}
332
333fn __atomic_fetch_or_1(ptr: *u8, val: u8, model: i32) callconv(.C) u8 {
334 return fetch_op_N(u8, .Or, ptr, val, model);
335}
336
337fn __atomic_fetch_or_2(ptr: *u16, val: u16, model: i32) callconv(.C) u16 {
338 return fetch_op_N(u16, .Or, ptr, val, model);
339}
340
341fn __atomic_fetch_or_4(ptr: *u32, val: u32, model: i32) callconv(.C) u32 {
342 return fetch_op_N(u32, .Or, ptr, val, model);
343}
344
345fn __atomic_fetch_or_8(ptr: *u64, val: u64, model: i32) callconv(.C) u64 {
346 return fetch_op_N(u64, .Or, ptr, val, model);
347}
348
349fn __atomic_fetch_xor_1(ptr: *u8, val: u8, model: i32) callconv(.C) u8 {
350 return fetch_op_N(u8, .Xor, ptr, val, model);
351}
352
353fn __atomic_fetch_xor_2(ptr: *u16, val: u16, model: i32) callconv(.C) u16 {
354 return fetch_op_N(u16, .Xor, ptr, val, model);
355}
356
357fn __atomic_fetch_xor_4(ptr: *u32, val: u32, model: i32) callconv(.C) u32 {
358 return fetch_op_N(u32, .Xor, ptr, val, model);
359}
360
361fn __atomic_fetch_xor_8(ptr: *u64, val: u64, model: i32) callconv(.C) u64 {
362 return fetch_op_N(u64, .Xor, ptr, val, model);
363}
364
365fn __atomic_fetch_nand_1(ptr: *u8, val: u8, model: i32) callconv(.C) u8 {
366 return fetch_op_N(u8, .Nand, ptr, val, model);
367}
368
369fn __atomic_fetch_nand_2(ptr: *u16, val: u16, model: i32) callconv(.C) u16 {
370 return fetch_op_N(u16, .Nand, ptr, val, model);
371}
372
373fn __atomic_fetch_nand_4(ptr: *u32, val: u32, model: i32) callconv(.C) u32 {
374 return fetch_op_N(u32, .Nand, ptr, val, model);
375}
376
377fn __atomic_fetch_nand_8(ptr: *u64, val: u64, model: i32) callconv(.C) u64 {
378 return fetch_op_N(u64, .Nand, ptr, val, model);
285379}
286380
287381comptime {
288382 if (supports_atomic_ops) {
289 const fetch_add_u8 = fetchFn(u8, .Add);
290 const fetch_add_u16 = fetchFn(u16, .Add);
291 const fetch_add_u32 = fetchFn(u32, .Add);
292 const fetch_add_u64 = fetchFn(u64, .Add);
293 @export(fetch_add_u8, .{ .name = "__atomic_fetch_add_1", .linkage = linkage });
294 @export(fetch_add_u16, .{ .name = "__atomic_fetch_add_2", .linkage = linkage });
295 @export(fetch_add_u32, .{ .name = "__atomic_fetch_add_4", .linkage = linkage });
296 @export(fetch_add_u64, .{ .name = "__atomic_fetch_add_8", .linkage = linkage });
297
298 const fetch_sub_u8 = fetchFn(u8, .Sub);
299 const fetch_sub_u16 = fetchFn(u16, .Sub);
300 const fetch_sub_u32 = fetchFn(u32, .Sub);
301 const fetch_sub_u64 = fetchFn(u64, .Sub);
302 @export(fetch_sub_u8, .{ .name = "__atomic_fetch_sub_1", .linkage = linkage });
303 @export(fetch_sub_u16, .{ .name = "__atomic_fetch_sub_2", .linkage = linkage });
304 @export(fetch_sub_u32, .{ .name = "__atomic_fetch_sub_4", .linkage = linkage });
305 @export(fetch_sub_u64, .{ .name = "__atomic_fetch_sub_8", .linkage = linkage });
306
307 const fetch_and_u8 = fetchFn(u8, .And);
308 const fetch_and_u16 = fetchFn(u16, .And);
309 const fetch_and_u32 = fetchFn(u32, .And);
310 const fetch_and_u64 = fetchFn(u64, .And);
311 @export(fetch_and_u8, .{ .name = "__atomic_fetch_and_1", .linkage = linkage });
312 @export(fetch_and_u16, .{ .name = "__atomic_fetch_and_2", .linkage = linkage });
313 @export(fetch_and_u32, .{ .name = "__atomic_fetch_and_4", .linkage = linkage });
314 @export(fetch_and_u64, .{ .name = "__atomic_fetch_and_8", .linkage = linkage });
315
316 const fetch_or_u8 = fetchFn(u8, .Or);
317 const fetch_or_u16 = fetchFn(u16, .Or);
318 const fetch_or_u32 = fetchFn(u32, .Or);
319 const fetch_or_u64 = fetchFn(u64, .Or);
320 @export(fetch_or_u8, .{ .name = "__atomic_fetch_or_1", .linkage = linkage });
321 @export(fetch_or_u16, .{ .name = "__atomic_fetch_or_2", .linkage = linkage });
322 @export(fetch_or_u32, .{ .name = "__atomic_fetch_or_4", .linkage = linkage });
323 @export(fetch_or_u64, .{ .name = "__atomic_fetch_or_8", .linkage = linkage });
324
325 const fetch_xor_u8 = fetchFn(u8, .Xor);
326 const fetch_xor_u16 = fetchFn(u16, .Xor);
327 const fetch_xor_u32 = fetchFn(u32, .Xor);
328 const fetch_xor_u64 = fetchFn(u64, .Xor);
329 @export(fetch_xor_u8, .{ .name = "__atomic_fetch_xor_1", .linkage = linkage });
330 @export(fetch_xor_u16, .{ .name = "__atomic_fetch_xor_2", .linkage = linkage });
331 @export(fetch_xor_u32, .{ .name = "__atomic_fetch_xor_4", .linkage = linkage });
332 @export(fetch_xor_u64, .{ .name = "__atomic_fetch_xor_8", .linkage = linkage });
333
334 const fetch_nand_u8 = fetchFn(u8, .Nand);
335 const fetch_nand_u16 = fetchFn(u16, .Nand);
336 const fetch_nand_u32 = fetchFn(u32, .Nand);
337 const fetch_nand_u64 = fetchFn(u64, .Nand);
338 @export(fetch_nand_u8, .{ .name = "__atomic_fetch_nand_1", .linkage = linkage });
339 @export(fetch_nand_u16, .{ .name = "__atomic_fetch_nand_2", .linkage = linkage });
340 @export(fetch_nand_u32, .{ .name = "__atomic_fetch_nand_4", .linkage = linkage });
341 @export(fetch_nand_u64, .{ .name = "__atomic_fetch_nand_8", .linkage = linkage });
383 @export(__atomic_fetch_add_1, .{ .name = "__atomic_fetch_add_1", .linkage = linkage });
384 @export(__atomic_fetch_add_2, .{ .name = "__atomic_fetch_add_2", .linkage = linkage });
385 @export(__atomic_fetch_add_4, .{ .name = "__atomic_fetch_add_4", .linkage = linkage });
386 @export(__atomic_fetch_add_8, .{ .name = "__atomic_fetch_add_8", .linkage = linkage });
387
388 @export(__atomic_fetch_sub_1, .{ .name = "__atomic_fetch_sub_1", .linkage = linkage });
389 @export(__atomic_fetch_sub_2, .{ .name = "__atomic_fetch_sub_2", .linkage = linkage });
390 @export(__atomic_fetch_sub_4, .{ .name = "__atomic_fetch_sub_4", .linkage = linkage });
391 @export(__atomic_fetch_sub_8, .{ .name = "__atomic_fetch_sub_8", .linkage = linkage });
392
393 @export(__atomic_fetch_and_1, .{ .name = "__atomic_fetch_and_1", .linkage = linkage });
394 @export(__atomic_fetch_and_2, .{ .name = "__atomic_fetch_and_2", .linkage = linkage });
395 @export(__atomic_fetch_and_4, .{ .name = "__atomic_fetch_and_4", .linkage = linkage });
396 @export(__atomic_fetch_and_8, .{ .name = "__atomic_fetch_and_8", .linkage = linkage });
397
398 @export(__atomic_fetch_or_1, .{ .name = "__atomic_fetch_or_1", .linkage = linkage });
399 @export(__atomic_fetch_or_2, .{ .name = "__atomic_fetch_or_2", .linkage = linkage });
400 @export(__atomic_fetch_or_4, .{ .name = "__atomic_fetch_or_4", .linkage = linkage });
401 @export(__atomic_fetch_or_8, .{ .name = "__atomic_fetch_or_8", .linkage = linkage });
402
403 @export(__atomic_fetch_xor_1, .{ .name = "__atomic_fetch_xor_1", .linkage = linkage });
404 @export(__atomic_fetch_xor_2, .{ .name = "__atomic_fetch_xor_2", .linkage = linkage });
405 @export(__atomic_fetch_xor_4, .{ .name = "__atomic_fetch_xor_4", .linkage = linkage });
406 @export(__atomic_fetch_xor_8, .{ .name = "__atomic_fetch_xor_8", .linkage = linkage });
407
408 @export(__atomic_fetch_nand_1, .{ .name = "__atomic_fetch_nand_1", .linkage = linkage });
409 @export(__atomic_fetch_nand_2, .{ .name = "__atomic_fetch_nand_2", .linkage = linkage });
410 @export(__atomic_fetch_nand_4, .{ .name = "__atomic_fetch_nand_4", .linkage = linkage });
411 @export(__atomic_fetch_nand_8, .{ .name = "__atomic_fetch_nand_8", .linkage = linkage });
412
413 @export(__atomic_load_1, .{ .name = "__atomic_load_1", .linkage = linkage });
414 @export(__atomic_load_2, .{ .name = "__atomic_load_2", .linkage = linkage });
415 @export(__atomic_load_4, .{ .name = "__atomic_load_4", .linkage = linkage });
416 @export(__atomic_load_8, .{ .name = "__atomic_load_8", .linkage = linkage });
417
418 @export(__atomic_store_1, .{ .name = "__atomic_store_1", .linkage = linkage });
419 @export(__atomic_store_2, .{ .name = "__atomic_store_2", .linkage = linkage });
420 @export(__atomic_store_4, .{ .name = "__atomic_store_4", .linkage = linkage });
421 @export(__atomic_store_8, .{ .name = "__atomic_store_8", .linkage = linkage });
422
423 @export(__atomic_exchange_1, .{ .name = "__atomic_exchange_1", .linkage = linkage });
424 @export(__atomic_exchange_2, .{ .name = "__atomic_exchange_2", .linkage = linkage });
425 @export(__atomic_exchange_4, .{ .name = "__atomic_exchange_4", .linkage = linkage });
426 @export(__atomic_exchange_8, .{ .name = "__atomic_exchange_8", .linkage = linkage });
427
428 @export(__atomic_compare_exchange_1, .{ .name = "__atomic_compare_exchange_1", .linkage = linkage });
429 @export(__atomic_compare_exchange_2, .{ .name = "__atomic_compare_exchange_2", .linkage = linkage });
430 @export(__atomic_compare_exchange_4, .{ .name = "__atomic_compare_exchange_4", .linkage = linkage });
431 @export(__atomic_compare_exchange_8, .{ .name = "__atomic_compare_exchange_8", .linkage = linkage });
342432 }
343433}
lib/std/special/compiler_rt/bswap.zig+55-55
......@@ -2,7 +2,7 @@ const std = @import("std");
22const builtin = @import("builtin");
33
44// bswap - byteswap
5// - bswapXi2_generic for unoptimized big and little endian
5// - bswapXi2 for unoptimized big and little endian
66// ie for u32
77// DE AD BE EF <- little|big endian
88// FE BE AD DE <- big|little endian
......@@ -11,64 +11,64 @@ const builtin = @import("builtin");
1111// 00 00 ff 00 << 1*8 (2n right byte)
1212// 00 00 00 ff << 3*8 (rightmost byte)
1313
14fn bswapXi2_generic(comptime T: type) fn (a: T) callconv(.C) T {
15 return struct {
16 fn f(a: T) callconv(.C) T {
17 @setRuntimeSafety(builtin.is_test);
18 switch (@bitSizeOf(T)) {
19 32 => {
20 // zig fmt: off
21 return (((a & 0xff000000) >> 24)
22 | ((a & 0x00ff0000) >> 8 )
23 | ((a & 0x0000ff00) << 8 )
24 | ((a & 0x000000ff) << 24));
25 // zig fmt: on
26 },
27 64 => {
28 // zig fmt: off
29 return (((a & 0xff00000000000000) >> 56)
30 | ((a & 0x00ff000000000000) >> 40 )
31 | ((a & 0x0000ff0000000000) >> 24 )
32 | ((a & 0x000000ff00000000) >> 8 )
33 | ((a & 0x00000000ff000000) << 8 )
34 | ((a & 0x0000000000ff0000) << 24 )
35 | ((a & 0x000000000000ff00) << 40 )
36 | ((a & 0x00000000000000ff) << 56));
37 // zig fmt: on
38 },
39 128 => {
40 // zig fmt: off
41 return (((a & 0xff000000000000000000000000000000) >> 120)
42 | ((a & 0x00ff0000000000000000000000000000) >> 104)
43 | ((a & 0x0000ff00000000000000000000000000) >> 88 )
44 | ((a & 0x000000ff000000000000000000000000) >> 72 )
45 | ((a & 0x00000000ff0000000000000000000000) >> 56 )
46 | ((a & 0x0000000000ff00000000000000000000) >> 40 )
47 | ((a & 0x000000000000ff000000000000000000) >> 24 )
48 | ((a & 0x00000000000000ff0000000000000000) >> 8 )
49 | ((a & 0x0000000000000000ff00000000000000) << 8 )
50 | ((a & 0x000000000000000000ff000000000000) << 24 )
51 | ((a & 0x00000000000000000000ff0000000000) << 40 )
52 | ((a & 0x0000000000000000000000ff00000000) << 56 )
53 | ((a & 0x000000000000000000000000ff000000) << 72 )
54 | ((a & 0x00000000000000000000000000ff0000) << 88 )
55 | ((a & 0x0000000000000000000000000000ff00) << 104)
56 | ((a & 0x000000000000000000000000000000ff) << 120));
57 // zig fmt: on
58 },
59 else => {
60 unreachable;
61 },
62 }
63 }
64 }.f;
14inline fn bswapXi2(comptime T: type, a: T) T {
15 @setRuntimeSafety(builtin.is_test);
16 switch (@bitSizeOf(T)) {
17 32 => {
18 // zig fmt: off
19 return (((a & 0xff000000) >> 24)
20 | ((a & 0x00ff0000) >> 8 )
21 | ((a & 0x0000ff00) << 8 )
22 | ((a & 0x000000ff) << 24));
23 // zig fmt: on
24 },
25 64 => {
26 // zig fmt: off
27 return (((a & 0xff00000000000000) >> 56)
28 | ((a & 0x00ff000000000000) >> 40 )
29 | ((a & 0x0000ff0000000000) >> 24 )
30 | ((a & 0x000000ff00000000) >> 8 )
31 | ((a & 0x00000000ff000000) << 8 )
32 | ((a & 0x0000000000ff0000) << 24 )
33 | ((a & 0x000000000000ff00) << 40 )
34 | ((a & 0x00000000000000ff) << 56));
35 // zig fmt: on
36 },
37 128 => {
38 // zig fmt: off
39 return (((a & 0xff000000000000000000000000000000) >> 120)
40 | ((a & 0x00ff0000000000000000000000000000) >> 104)
41 | ((a & 0x0000ff00000000000000000000000000) >> 88 )
42 | ((a & 0x000000ff000000000000000000000000) >> 72 )
43 | ((a & 0x00000000ff0000000000000000000000) >> 56 )
44 | ((a & 0x0000000000ff00000000000000000000) >> 40 )
45 | ((a & 0x000000000000ff000000000000000000) >> 24 )
46 | ((a & 0x00000000000000ff0000000000000000) >> 8 )
47 | ((a & 0x0000000000000000ff00000000000000) << 8 )
48 | ((a & 0x000000000000000000ff000000000000) << 24 )
49 | ((a & 0x00000000000000000000ff0000000000) << 40 )
50 | ((a & 0x0000000000000000000000ff00000000) << 56 )
51 | ((a & 0x000000000000000000000000ff000000) << 72 )
52 | ((a & 0x00000000000000000000000000ff0000) << 88 )
53 | ((a & 0x0000000000000000000000000000ff00) << 104)
54 | ((a & 0x000000000000000000000000000000ff) << 120));
55 // zig fmt: on
56 },
57 else => unreachable,
58 }
6559}
6660
67pub const __bswapsi2 = bswapXi2_generic(u32);
61pub fn __bswapsi2(a: u32) callconv(.C) u32 {
62 return bswapXi2(u32, a);
63}
6864
69pub const __bswapdi2 = bswapXi2_generic(u64);
65pub fn __bswapdi2(a: u64) callconv(.C) u64 {
66 return bswapXi2(u64, a);
67}
7068
71pub const __bswapti2 = bswapXi2_generic(u128);
69pub fn __bswapti2(a: u128) callconv(.C) u128 {
70 return bswapXi2(u128, a);
71}
7272
7373test {
7474 _ = @import("bswapsi2_test.zig");
lib/std/special/compiler_rt/cmp.zig+34-22
......@@ -11,28 +11,40 @@ const builtin = @import("builtin");
1111// a == b => 1
1212// a > b => 2
1313
14fn XcmpXi2_generic(comptime T: type) fn (a: T, b: T) callconv(.C) i32 {
15 return struct {
16 fn f(a: T, b: T) callconv(.C) i32 {
17 @setRuntimeSafety(builtin.is_test);
18 var cmp1: i32 = 0;
19 var cmp2: i32 = 0;
20 if (a > b)
21 cmp1 = 1;
22 if (a < b)
23 cmp2 = 1;
24 return cmp1 - cmp2 + 1;
25 }
26 }.f;
27}
28
29pub const __cmpsi2 = XcmpXi2_generic(i32);
30pub const __cmpdi2 = XcmpXi2_generic(i64);
31pub const __cmpti2 = XcmpXi2_generic(i128);
32
33pub const __ucmpsi2 = XcmpXi2_generic(u32);
34pub const __ucmpdi2 = XcmpXi2_generic(u64);
35pub const __ucmpti2 = XcmpXi2_generic(u128);
14inline fn XcmpXi2(comptime T: type, a: T, b: T) i32 {
15 @setRuntimeSafety(builtin.is_test);
16 var cmp1: i32 = 0;
17 var cmp2: i32 = 0;
18 if (a > b)
19 cmp1 = 1;
20 if (a < b)
21 cmp2 = 1;
22 return cmp1 - cmp2 + 1;
23}
24
25pub fn __cmpsi2(a: i32, b: i32) callconv(.C) i32 {
26 return XcmpXi2(i32, a, b);
27}
28
29pub fn __cmpdi2(a: i64, b: i64) callconv(.C) i32 {
30 return XcmpXi2(i64, a, b);
31}
32
33pub fn __cmpti2(a: i128, b: i128) callconv(.C) i32 {
34 return XcmpXi2(i128, a, b);
35}
36
37pub fn __ucmpsi2(a: u32, b: u32) callconv(.C) i32 {
38 return XcmpXi2(u32, a, b);
39}
40
41pub fn __ucmpdi2(a: u64, b: u64) callconv(.C) i32 {
42 return XcmpXi2(u64, a, b);
43}
44
45pub fn __ucmpti2(a: u128, b: u128) callconv(.C) i32 {
46 return XcmpXi2(u128, a, b);
47}
3648
3749test {
3850 _ = @import("cmpsi2_test.zig");
lib/std/special/compiler_rt/count0bits.zig+122-116
......@@ -2,44 +2,40 @@ const std = @import("std");
22const builtin = @import("builtin");
33
44// clz - count leading zeroes
5// - clzXi2_generic for unoptimized little and big endian
5// - clzXi2 for unoptimized little and big endian
66// - __clzsi2_thumb1: assume a != 0
77// - __clzsi2_arm32: assume a != 0
88
99// ctz - count trailing zeroes
10// - ctzXi2_generic for unoptimized little and big endian
10// - ctzXi2 for unoptimized little and big endian
1111
1212// ffs - find first set
1313// * ffs = (a == 0) => 0, (a != 0) => ctz + 1
1414// * dont pay for `if (x == 0) return shift;` inside ctz
15// - ffsXi2_generic for unoptimized little and big endian
16
17fn clzXi2_generic(comptime T: type) fn (a: T) callconv(.C) i32 {
18 return struct {
19 fn f(a: T) callconv(.C) i32 {
20 @setRuntimeSafety(builtin.is_test);
21
22 var x = switch (@bitSizeOf(T)) {
23 32 => @bitCast(u32, a),
24 64 => @bitCast(u64, a),
25 128 => @bitCast(u128, a),
26 else => unreachable,
27 };
28 var n: T = @bitSizeOf(T);
29 // Count first bit set using binary search, from Hacker's Delight
30 var y: @TypeOf(x) = 0;
31 comptime var shift: u8 = @bitSizeOf(T);
32 inline while (shift > 0) {
33 shift = shift >> 1;
34 y = x >> shift;
35 if (y != 0) {
36 n = n - shift;
37 x = y;
38 }
39 }
40 return @intCast(i32, n - @bitCast(T, x));
15// - ffsXi2 for unoptimized little and big endian
16
17inline fn clzXi2(comptime T: type, a: T) i32 {
18 @setRuntimeSafety(builtin.is_test);
19
20 var x = switch (@bitSizeOf(T)) {
21 32 => @bitCast(u32, a),
22 64 => @bitCast(u64, a),
23 128 => @bitCast(u128, a),
24 else => unreachable,
25 };
26 var n: T = @bitSizeOf(T);
27 // Count first bit set using binary search, from Hacker's Delight
28 var y: @TypeOf(x) = 0;
29 comptime var shift: u8 = @bitSizeOf(T);
30 inline while (shift > 0) {
31 shift = shift >> 1;
32 y = x >> shift;
33 if (y != 0) {
34 n = n - shift;
35 x = y;
4136 }
42 }.f;
37 }
38 return @intCast(i32, n - @bitCast(T, x));
4339}
4440
4541fn __clzsi2_thumb1() callconv(.Naked) void {
......@@ -125,103 +121,113 @@ fn __clzsi2_arm32() callconv(.Naked) void {
125121 unreachable;
126122}
127123
128pub const __clzsi2 = impl: {
129 switch (builtin.cpu.arch) {
130 .arm, .armeb, .thumb, .thumbeb => {
131 const use_thumb1 =
132 (builtin.cpu.arch.isThumb() or
133 std.Target.arm.featureSetHas(builtin.cpu.features, .noarm)) and
134 !std.Target.arm.featureSetHas(builtin.cpu.features, .thumb2);
135
136 if (use_thumb1) {
137 break :impl __clzsi2_thumb1;
138 }
139 // From here on we're either targeting Thumb2 or ARM.
140 else if (!builtin.cpu.arch.isThumb()) {
141 break :impl __clzsi2_arm32;
142 }
143 // Use the generic implementation otherwise.
144 else break :impl clzXi2_generic(i32);
145 },
146 else => break :impl clzXi2_generic(i32),
147 }
124fn clzsi2_generic(a: i32) callconv(.C) i32 {
125 return clzXi2(i32, a);
126}
127
128pub const __clzsi2 = switch (builtin.cpu.arch) {
129 .arm, .armeb, .thumb, .thumbeb => impl: {
130 const use_thumb1 =
131 (builtin.cpu.arch.isThumb() or
132 std.Target.arm.featureSetHas(builtin.cpu.features, .noarm)) and
133 !std.Target.arm.featureSetHas(builtin.cpu.features, .thumb2);
134
135 if (use_thumb1) {
136 break :impl __clzsi2_thumb1;
137 }
138 // From here on we're either targeting Thumb2 or ARM.
139 else if (!builtin.cpu.arch.isThumb()) {
140 break :impl __clzsi2_arm32;
141 }
142 // Use the generic implementation otherwise.
143 else break :impl clzsi2_generic;
144 },
145 else => clzsi2_generic,
148146};
149147
150pub const __clzdi2 = clzXi2_generic(i64);
151
152pub const __clzti2 = clzXi2_generic(i128);
153
154fn ctzXi2_generic(comptime T: type) fn (a: T) callconv(.C) i32 {
155 return struct {
156 fn f(a: T) callconv(.C) i32 {
157 @setRuntimeSafety(builtin.is_test);
158
159 var x = switch (@bitSizeOf(T)) {
160 32 => @bitCast(u32, a),
161 64 => @bitCast(u64, a),
162 128 => @bitCast(u128, a),
163 else => unreachable,
164 };
165 var n: T = 1;
166 // Number of trailing zeroes as binary search, from Hacker's Delight
167 var mask: @TypeOf(x) = std.math.maxInt(@TypeOf(x));
168 comptime var shift = @bitSizeOf(T);
169 if (x == 0) return shift;
170 inline while (shift > 1) {
171 shift = shift >> 1;
172 mask = mask >> shift;
173 if ((x & mask) == 0) {
174 n = n + shift;
175 x = x >> shift;
176 }
177 }
178 return @intCast(i32, n - @bitCast(T, (x & 1)));
148pub fn __clzdi2(a: i64) callconv(.C) i32 {
149 return clzXi2(i64, a);
150}
151
152pub fn __clzti2(a: i128) callconv(.C) i32 {
153 return clzXi2(i128, a);
154}
155
156inline fn ctzXi2(comptime T: type, a: T) i32 {
157 @setRuntimeSafety(builtin.is_test);
158
159 var x = switch (@bitSizeOf(T)) {
160 32 => @bitCast(u32, a),
161 64 => @bitCast(u64, a),
162 128 => @bitCast(u128, a),
163 else => unreachable,
164 };
165 var n: T = 1;
166 // Number of trailing zeroes as binary search, from Hacker's Delight
167 var mask: @TypeOf(x) = std.math.maxInt(@TypeOf(x));
168 comptime var shift = @bitSizeOf(T);
169 if (x == 0) return shift;
170 inline while (shift > 1) {
171 shift = shift >> 1;
172 mask = mask >> shift;
173 if ((x & mask) == 0) {
174 n = n + shift;
175 x = x >> shift;
179176 }
180 }.f;
177 }
178 return @intCast(i32, n - @bitCast(T, (x & 1)));
179}
180
181pub fn __ctzsi2(a: i32) callconv(.C) i32 {
182 return ctzXi2(i32, a);
181183}
182184
183pub const __ctzsi2 = ctzXi2_generic(i32);
184
185pub const __ctzdi2 = ctzXi2_generic(i64);
186
187pub const __ctzti2 = ctzXi2_generic(i128);
188
189fn ffsXi2_generic(comptime T: type) fn (a: T) callconv(.C) i32 {
190 return struct {
191 fn f(a: T) callconv(.C) i32 {
192 @setRuntimeSafety(builtin.is_test);
193
194 var x = switch (@bitSizeOf(T)) {
195 32 => @bitCast(u32, a),
196 64 => @bitCast(u64, a),
197 128 => @bitCast(u128, a),
198 else => unreachable,
199 };
200 var n: T = 1;
201 // adapted from Number of trailing zeroes (see ctzXi2_generic)
202 var mask: @TypeOf(x) = std.math.maxInt(@TypeOf(x));
203 comptime var shift = @bitSizeOf(T);
204 // In contrast to ctz return 0
205 if (x == 0) return 0;
206 inline while (shift > 1) {
207 shift = shift >> 1;
208 mask = mask >> shift;
209 if ((x & mask) == 0) {
210 n = n + shift;
211 x = x >> shift;
212 }
213 }
214 // return ctz + 1
215 return @intCast(i32, n - @bitCast(T, (x & 1))) + @as(i32, 1);
185pub fn __ctzdi2(a: i64) callconv(.C) i32 {
186 return ctzXi2(i64, a);
187}
188
189pub fn __ctzti2(a: i128) callconv(.C) i32 {
190 return ctzXi2(i128, a);
191}
192
193inline fn ffsXi2(comptime T: type, a: T) i32 {
194 @setRuntimeSafety(builtin.is_test);
195
196 var x = switch (@bitSizeOf(T)) {
197 32 => @bitCast(u32, a),
198 64 => @bitCast(u64, a),
199 128 => @bitCast(u128, a),
200 else => unreachable,
201 };
202 var n: T = 1;
203 // adapted from Number of trailing zeroes (see ctzXi2)
204 var mask: @TypeOf(x) = std.math.maxInt(@TypeOf(x));
205 comptime var shift = @bitSizeOf(T);
206 // In contrast to ctz return 0
207 if (x == 0) return 0;
208 inline while (shift > 1) {
209 shift = shift >> 1;
210 mask = mask >> shift;
211 if ((x & mask) == 0) {
212 n = n + shift;
213 x = x >> shift;
216214 }
217 }.f;
215 }
216 // return ctz + 1
217 return @intCast(i32, n - @bitCast(T, (x & 1))) + @as(i32, 1);
218218}
219219
220pub const __ffssi2 = ffsXi2_generic(i32);
220pub fn __ffssi2(a: i32) callconv(.C) i32 {
221 return ffsXi2(i32, a);
222}
221223
222pub const __ffsdi2 = ffsXi2_generic(i64);
224pub fn __ffsdi2(a: i64) callconv(.C) i32 {
225 return ffsXi2(i64, a);
226}
223227
224pub const __ffsti2 = ffsXi2_generic(i128);
228pub fn __ffsti2(a: i128) callconv(.C) i32 {
229 return ffsXi2(i128, a);
230}
225231
226232test {
227233 _ = @import("clzsi2_test.zig");
lib/std/special/compiler_rt/fixuint.zig+1-1
......@@ -1,7 +1,7 @@
11const is_test = @import("builtin").is_test;
22const Log2Int = @import("std").math.Log2Int;
33
4pub fn fixuint(comptime fp_t: type, comptime fixuint_t: type, a: fp_t) fixuint_t {
4pub inline fn fixuint(comptime fp_t: type, comptime fixuint_t: type, a: fp_t) fixuint_t {
55 @setRuntimeSafety(is_test);
66
77 const rep_t = switch (fp_t) {
lib/std/special/compiler_rt/floatXisf.zig+4-7
......@@ -4,7 +4,7 @@ const maxInt = std.math.maxInt;
44
55const FLT_MANT_DIG = 24;
66
7fn __floatXisf(comptime T: type, arg: T) f32 {
7inline fn floatXisf(comptime T: type, arg: T) f32 {
88 @setRuntimeSafety(builtin.is_test);
99
1010 const bits = @typeInfo(T).Int.bits;
......@@ -71,18 +71,15 @@ fn __floatXisf(comptime T: type, arg: T) f32 {
7171}
7272
7373pub fn __floatdisf(arg: i64) callconv(.C) f32 {
74 @setRuntimeSafety(builtin.is_test);
75 return @call(.{ .modifier = .always_inline }, __floatXisf, .{ i64, arg });
74 return floatXisf(i64, arg);
7675}
7776
7877pub fn __floattisf(arg: i128) callconv(.C) f32 {
79 @setRuntimeSafety(builtin.is_test);
80 return @call(.{ .modifier = .always_inline }, __floatXisf, .{ i128, arg });
78 return floatXisf(i128, arg);
8179}
8280
8381pub fn __aeabi_l2f(arg: i64) callconv(.AAPCS) f32 {
84 @setRuntimeSafety(false);
85 return @call(.{ .modifier = .always_inline }, __floatdisf, .{arg});
82 return floatXisf(i64, arg);
8683}
8784
8885test {
lib/std/special/compiler_rt/floatsiXf.zig+6-6
......@@ -2,7 +2,7 @@ const builtin = @import("builtin");
22const std = @import("std");
33const maxInt = std.math.maxInt;
44
5fn floatsiXf(comptime T: type, a: i32) T {
5inline fn floatsiXf(comptime T: type, a: i32) T {
66 @setRuntimeSafety(builtin.is_test);
77
88 const bits = @typeInfo(T).Float.bits;
......@@ -56,27 +56,27 @@ fn floatsiXf(comptime T: type, a: i32) T {
5656
5757pub fn __floatsisf(arg: i32) callconv(.C) f32 {
5858 @setRuntimeSafety(builtin.is_test);
59 return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f32, arg });
59 return floatsiXf(f32, arg);
6060}
6161
6262pub fn __floatsidf(arg: i32) callconv(.C) f64 {
6363 @setRuntimeSafety(builtin.is_test);
64 return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f64, arg });
64 return floatsiXf(f64, arg);
6565}
6666
6767pub fn __floatsitf(arg: i32) callconv(.C) f128 {
6868 @setRuntimeSafety(builtin.is_test);
69 return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f128, arg });
69 return floatsiXf(f128, arg);
7070}
7171
7272pub fn __aeabi_i2d(arg: i32) callconv(.AAPCS) f64 {
7373 @setRuntimeSafety(false);
74 return @call(.{ .modifier = .always_inline }, __floatsidf, .{arg});
74 return floatsiXf(f64, arg);
7575}
7676
7777pub fn __aeabi_i2f(arg: i32) callconv(.AAPCS) f32 {
7878 @setRuntimeSafety(false);
79 return @call(.{ .modifier = .always_inline }, __floatsisf, .{arg});
79 return floatsiXf(f32, arg);
8080}
8181
8282fn test_one_floatsitf(a: i32, expected: u128) !void {
lib/std/special/compiler_rt/floatundisf.zig+6-3
......@@ -4,7 +4,7 @@ const maxInt = std.math.maxInt;
44
55const FLT_MANT_DIG = 24;
66
7pub fn __floatundisf(arg: u64) callconv(.C) f32 {
7inline fn floatundisf(arg: u64) f32 {
88 @setRuntimeSafety(builtin.is_test);
99
1010 if (arg == 0) return 0;
......@@ -56,9 +56,12 @@ pub fn __floatundisf(arg: u64) callconv(.C) f32 {
5656 return @bitCast(f32, result);
5757}
5858
59pub fn __floatundisf(arg: u64) callconv(.C) f32 {
60 return floatundisf(arg);
61}
62
5963pub fn __aeabi_ul2f(arg: u64) callconv(.AAPCS) f32 {
60 @setRuntimeSafety(false);
61 return @call(.{ .modifier = .always_inline }, __floatundisf, .{arg});
64 return floatundisf(arg);
6265}
6366
6467fn test__floatundisf(a: u64, expected: f32) !void {
lib/std/special/compiler_rt/floatunsidf.zig+6-3
......@@ -4,7 +4,7 @@ const maxInt = std.math.maxInt;
44
55const implicitBit = @as(u64, 1) << 52;
66
7pub fn __floatunsidf(arg: u32) callconv(.C) f64 {
7inline fn floatunsidf(arg: u32) f64 {
88 @setRuntimeSafety(builtin.is_test);
99
1010 if (arg == 0) return 0.0;
......@@ -18,9 +18,12 @@ pub fn __floatunsidf(arg: u32) callconv(.C) f64 {
1818 return @bitCast(f64, mant | (exp + 1023) << 52);
1919}
2020
21pub fn __floatunsidf(arg: u32) callconv(.C) f64 {
22 return floatunsidf(arg);
23}
24
2125pub fn __aeabi_ui2d(arg: u32) callconv(.AAPCS) f64 {
22 @setRuntimeSafety(false);
23 return @call(.{ .modifier = .always_inline }, __floatunsidf, .{arg});
26 return floatunsidf(arg);
2427}
2528
2629fn test_one_floatunsidf(a: u32, expected: u64) !void {
lib/std/special/compiler_rt/floatunsisf.zig+6-3
......@@ -6,7 +6,7 @@ const significandBits = 23;
66const exponentBias = 127;
77const implicitBit = @as(u32, 1) << significandBits;
88
9pub fn __floatunsisf(arg: u32) callconv(.C) f32 {
9inline fn floatunsisf(arg: u32) f32 {
1010 @setRuntimeSafety(builtin.is_test);
1111
1212 if (arg == 0) return 0.0;
......@@ -38,9 +38,12 @@ pub fn __floatunsisf(arg: u32) callconv(.C) f32 {
3838 return @bitCast(f32, result);
3939}
4040
41pub fn __floatunsisf(arg: u32) callconv(.C) f32 {
42 return floatunsisf(arg);
43}
44
4145pub fn __aeabi_ui2f(arg: u32) callconv(.AAPCS) f32 {
42 @setRuntimeSafety(false);
43 return @call(.{ .modifier = .always_inline }, __floatunsisf, .{arg});
46 return floatunsisf(arg);
4447}
4548
4649fn test_one_floatunsisf(a: u32, expected: u32) !void {
lib/std/special/compiler_rt/negXi2.zig+13-11
......@@ -2,7 +2,7 @@ const std = @import("std");
22const builtin = @import("builtin");
33
44// neg - negate (the number)
5// - negXi2_generic for unoptimized little and big endian
5// - negXi2 for unoptimized little and big endian
66
77// sfffffff = 2^31-1
88// two's complement inverting bits and add 1 would result in -INT_MIN == 0
......@@ -11,20 +11,22 @@ const builtin = @import("builtin");
1111// * size optimized builds
1212// * machines that dont support carry operations
1313
14fn negXi2_generic(comptime T: type) fn (a: T) callconv(.C) T {
15 return struct {
16 fn f(a: T) callconv(.C) T {
17 @setRuntimeSafety(builtin.is_test);
18 return -a;
19 }
20 }.f;
14inline fn negXi2(comptime T: type, a: T) T {
15 @setRuntimeSafety(builtin.is_test);
16 return -a;
2117}
2218
23pub const __negsi2 = negXi2_generic(i32);
19pub fn __negsi2(a: i32) callconv(.C) i32 {
20 return negXi2(i32, a);
21}
2422
25pub const __negdi2 = negXi2_generic(i64);
23pub fn __negdi2(a: i64) callconv(.C) i64 {
24 return negXi2(i64, a);
25}
2626
27pub const __negti2 = negXi2_generic(i128);
27pub fn __negti2(a: i128) callconv(.C) i128 {
28 return negXi2(i128, a);
29}
2830
2931test {
3032 _ = @import("negsi2_test.zig");
lib/std/special/compiler_rt/negv.zig+24-19
......@@ -3,26 +3,31 @@
33// - negvXi4_generic for unoptimized version
44
55// assume -0 == 0 is gracefully handled by the hardware
6fn negvXi_generic(comptime ST: type) fn (a: ST) callconv(.C) ST {
7 return struct {
8 fn f(a: ST) callconv(.C) ST {
9 const UT = switch (ST) {
10 i32 => u32,
11 i64 => u64,
12 i128 => u128,
13 else => unreachable,
14 };
15 const N: UT = @bitSizeOf(ST);
16 const min: ST = @bitCast(ST, (@as(UT, 1) << (N - 1)));
17 if (a == min)
18 @panic("compiler_rt negv: overflow");
19 return -a;
20 }
21 }.f;
6inline fn negvXi(comptime ST: type, a: ST) ST {
7 const UT = switch (ST) {
8 i32 => u32,
9 i64 => u64,
10 i128 => u128,
11 else => unreachable,
12 };
13 const N: UT = @bitSizeOf(ST);
14 const min: ST = @bitCast(ST, (@as(UT, 1) << (N - 1)));
15 if (a == min)
16 @panic("compiler_rt negv: overflow");
17 return -a;
18}
19
20pub fn __negvsi2(a: i32) callconv(.C) i32 {
21 return negvXi(i32, a);
22}
23
24pub fn __negvdi2(a: i64) callconv(.C) i64 {
25 return negvXi(i64, a);
26}
27
28pub fn __negvti2(a: i128) callconv(.C) i128 {
29 return negvXi(i128, a);
2230}
23pub const __negvsi2 = negvXi_generic(i32);
24pub const __negvdi2 = negvXi_generic(i64);
25pub const __negvti2 = negvXi_generic(i128);
2631
2732test {
2833 _ = @import("negvsi2_test.zig");
lib/std/special/compiler_rt/parity.zig+25-23
......@@ -4,34 +4,36 @@ const builtin = @import("builtin");
44// parity - if number of bits set is even => 0, else => 1
55// - pariytXi2_generic for big and little endian
66
7fn parityXi2_generic(comptime T: type) fn (a: T) callconv(.C) i32 {
8 return struct {
9 fn f(a: T) callconv(.C) i32 {
10 @setRuntimeSafety(builtin.is_test);
7inline fn parityXi2(comptime T: type, a: T) i32 {
8 @setRuntimeSafety(builtin.is_test);
119
12 var x = switch (@bitSizeOf(T)) {
13 32 => @bitCast(u32, a),
14 64 => @bitCast(u64, a),
15 128 => @bitCast(u128, a),
16 else => unreachable,
17 };
18 // Bit Twiddling Hacks: Compute parity in parallel
19 comptime var shift: u8 = @bitSizeOf(T) / 2;
20 inline while (shift > 2) {
21 x ^= x >> shift;
22 shift = shift >> 1;
23 }
24 x &= 0xf;
25 return (@intCast(u16, 0x6996) >> @intCast(u4, x)) & 1; // optimization for >>2 and >>1
26 }
27 }.f;
10 var x = switch (@bitSizeOf(T)) {
11 32 => @bitCast(u32, a),
12 64 => @bitCast(u64, a),
13 128 => @bitCast(u128, a),
14 else => unreachable,
15 };
16 // Bit Twiddling Hacks: Compute parity in parallel
17 comptime var shift: u8 = @bitSizeOf(T) / 2;
18 inline while (shift > 2) {
19 x ^= x >> shift;
20 shift = shift >> 1;
21 }
22 x &= 0xf;
23 return (@intCast(u16, 0x6996) >> @intCast(u4, x)) & 1; // optimization for >>2 and >>1
2824}
2925
30pub const __paritysi2 = parityXi2_generic(i32);
26pub fn __paritysi2(a: i32) callconv(.C) i32 {
27 return parityXi2(i32, a);
28}
3129
32pub const __paritydi2 = parityXi2_generic(i64);
30pub fn __paritydi2(a: i64) callconv(.C) i32 {
31 return parityXi2(i64, a);
32}
3333
34pub const __parityti2 = parityXi2_generic(i128);
34pub fn __parityti2(a: i128) callconv(.C) i32 {
35 return parityXi2(i128, a);
36}
3537
3638test {
3739 _ = @import("paritysi2_test.zig");
lib/std/special/compiler_rt/popcount.zig+27-25
......@@ -10,35 +10,37 @@ const std = @import("std");
1010// TAOCP: Combinational Algorithms, Bitwise Tricks And Techniques,
1111// subsubsection "Working with the rightmost bits" and "Sideways addition".
1212
13fn popcountXi2_generic(comptime ST: type) fn (a: ST) callconv(.C) i32 {
14 return struct {
15 fn f(a: ST) callconv(.C) i32 {
16 @setRuntimeSafety(builtin.is_test);
17 const UT = switch (ST) {
18 i32 => u32,
19 i64 => u64,
20 i128 => u128,
21 else => unreachable,
22 };
23 var x = @bitCast(UT, a);
24 x -= (x >> 1) & (~@as(UT, 0) / 3); // 0x55...55, aggregate duos
25 x = ((x >> 2) & (~@as(UT, 0) / 5)) // 0x33...33, aggregate nibbles
26 + (x & (~@as(UT, 0) / 5));
27 x += x >> 4;
28 x &= ~@as(UT, 0) / 17; // 0x0F...0F, aggregate bytes
29 // 8 most significant bits of x + (x<<8) + (x<<16) + ..
30 x *%= ~@as(UT, 0) / 255; // 0x01...01
31 x >>= (@bitSizeOf(ST) - 8);
32 return @intCast(i32, x);
33 }
34 }.f;
13inline fn popcountXi2(comptime ST: type, a: ST) i32 {
14 @setRuntimeSafety(builtin.is_test);
15 const UT = switch (ST) {
16 i32 => u32,
17 i64 => u64,
18 i128 => u128,
19 else => unreachable,
20 };
21 var x = @bitCast(UT, a);
22 x -= (x >> 1) & (~@as(UT, 0) / 3); // 0x55...55, aggregate duos
23 x = ((x >> 2) & (~@as(UT, 0) / 5)) // 0x33...33, aggregate nibbles
24 + (x & (~@as(UT, 0) / 5));
25 x += x >> 4;
26 x &= ~@as(UT, 0) / 17; // 0x0F...0F, aggregate bytes
27 // 8 most significant bits of x + (x<<8) + (x<<16) + ..
28 x *%= ~@as(UT, 0) / 255; // 0x01...01
29 x >>= (@bitSizeOf(ST) - 8);
30 return @intCast(i32, x);
3531}
3632
37pub const __popcountsi2 = popcountXi2_generic(i32);
33pub fn __popcountsi2(a: i32) callconv(.C) i32 {
34 return popcountXi2(i32, a);
35}
3836
39pub const __popcountdi2 = popcountXi2_generic(i64);
37pub fn __popcountdi2(a: i64) callconv(.C) i32 {
38 return popcountXi2(i64, a);
39}
4040
41pub const __popcountti2 = popcountXi2_generic(i128);
41pub fn __popcountti2(a: i128) callconv(.C) i32 {
42 return popcountXi2(i128, a);
43}
4244
4345test {
4446 _ = @import("popcountsi2_test.zig");
lib/std/special/compiler_rt/shift.zig+12-12
......@@ -19,7 +19,7 @@ fn Dwords(comptime T: type, comptime signed_half: bool) type {
1919
2020// Arithmetic shift left
2121// Precondition: 0 <= b < bits_in_dword
22pub fn ashlXi3(comptime T: type, a: T, b: i32) T {
22pub inline fn ashlXi3(comptime T: type, a: T, b: i32) T {
2323 const dwords = Dwords(T, false);
2424 const S = Log2Int(dwords.HalfT);
2525
......@@ -42,7 +42,7 @@ pub fn ashlXi3(comptime T: type, a: T, b: i32) T {
4242
4343// Arithmetic shift right
4444// Precondition: 0 <= b < T.bit_count
45pub fn ashrXi3(comptime T: type, a: T, b: i32) T {
45pub inline fn ashrXi3(comptime T: type, a: T, b: i32) T {
4646 const dwords = Dwords(T, true);
4747 const S = Log2Int(dwords.HalfT);
4848
......@@ -69,7 +69,7 @@ pub fn ashrXi3(comptime T: type, a: T, b: i32) T {
6969
7070// Logical shift right
7171// Precondition: 0 <= b < T.bit_count
72pub fn lshrXi3(comptime T: type, a: T, b: i32) T {
72pub inline fn lshrXi3(comptime T: type, a: T, b: i32) T {
7373 const dwords = Dwords(T, false);
7474 const S = Log2Int(dwords.HalfT);
7575
......@@ -91,32 +91,32 @@ pub fn lshrXi3(comptime T: type, a: T, b: i32) T {
9191}
9292
9393pub fn __ashldi3(a: i64, b: i32) callconv(.C) i64 {
94 return @call(.{ .modifier = .always_inline }, ashlXi3, .{ i64, a, b });
94 return ashlXi3(i64, a, b);
9595}
9696pub fn __ashlti3(a: i128, b: i32) callconv(.C) i128 {
97 return @call(.{ .modifier = .always_inline }, ashlXi3, .{ i128, a, b });
97 return ashlXi3(i128, a, b);
9898}
9999pub fn __ashrdi3(a: i64, b: i32) callconv(.C) i64 {
100 return @call(.{ .modifier = .always_inline }, ashrXi3, .{ i64, a, b });
100 return ashrXi3(i64, a, b);
101101}
102102pub fn __ashrti3(a: i128, b: i32) callconv(.C) i128 {
103 return @call(.{ .modifier = .always_inline }, ashrXi3, .{ i128, a, b });
103 return ashrXi3(i128, a, b);
104104}
105105pub fn __lshrdi3(a: i64, b: i32) callconv(.C) i64 {
106 return @call(.{ .modifier = .always_inline }, lshrXi3, .{ i64, a, b });
106 return lshrXi3(i64, a, b);
107107}
108108pub fn __lshrti3(a: i128, b: i32) callconv(.C) i128 {
109 return @call(.{ .modifier = .always_inline }, lshrXi3, .{ i128, a, b });
109 return lshrXi3(i128, a, b);
110110}
111111
112112pub fn __aeabi_llsl(a: i64, b: i32) callconv(.AAPCS) i64 {
113 return __ashldi3(a, b);
113 return ashlXi3(i64, a, b);
114114}
115115pub fn __aeabi_lasr(a: i64, b: i32) callconv(.AAPCS) i64 {
116 return __ashrdi3(a, b);
116 return ashrXi3(i64, a, b);
117117}
118118pub fn __aeabi_llsr(a: i64, b: i32) callconv(.AAPCS) i64 {
119 return __lshrdi3(a, b);
119 return lshrXi3(i64, a, b);
120120}
121121
122122test {
src/type.zig+12-1
......@@ -4603,7 +4603,18 @@ pub const CType = enum {
46034603 .longlong,
46044604 .ulonglong,
46054605 => return 64,
4606 .longdouble => @panic("TODO figure out what kind of float `long double` is on this target"),
4606 .longdouble => switch (target.cpu.arch) {
4607 .riscv64,
4608 .aarch64,
4609 .aarch64_be,
4610 .aarch64_32,
4611 .s390x,
4612 .mips64,
4613 .mips64el,
4614 => return 128,
4615
4616 else => return 80,
4617 },
46074618 },
46084619
46094620 .windows, .uefi => switch (self) {