authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-09-24 22:04:37-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-10-01 15:09:52-04:00
log6d5cbdb86394d517a3428242a7ab26384843fc0c
treefa8b3ec6425a40e365efda271bc300e87e23d93c
parent3bd1b9e15f04128fa3a2c0c3c3969852b7cde9f2

behavior: cleanup floatop tests


3 files changed, 528 insertions(+), 638 deletions(-)

src/arch/x86_64/CodeGen.zig+3-1
......@@ -5303,7 +5303,9 @@ fn airUnaryMath(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void {
53035303 .f80_type => "__" ++ @tagName(comptime_tag) ++ "x",
53045304 .f128_type => @tagName(comptime_tag) ++ "q",
53055305 .c_longdouble_type => @tagName(comptime_tag) ++ "l",
5306 else => unreachable,
5306 else => return self.fail("TODO implement airUnaryMath for {s} of {}", .{
5307 @tagName(tag), ty.toType().fmt(self.bin_file.options.module.?),
5308 }),
53075309 },
53085310 else => unreachable,
53095311 },
test/behavior/floatop.zig+523-629
......@@ -19,34 +19,93 @@ fn epsForType(comptime T: type) T {
1919 };
2020}
2121
22test "floating point comparisons" {
22test "cmp f16" {
2323 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
24 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
25 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
26 if (no_x86_64_hardware_f16_support) return error.SkipZigTest;
27
28 try testCmp(f16);
29 try comptime testCmp(f16);
30}
31
32test "cmp f32/f64" {
33 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
34 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
2435
25 try testFloatComparisons();
26 try comptime testFloatComparisons();
36 try testCmp(f32);
37 try comptime testCmp(f32);
38 try testCmp(f64);
39 try comptime testCmp(f64);
2740}
2841
29fn testFloatComparisons() !void {
30 inline for ([_]type{ f16, f32, f64, f128 }) |T| {
42test "cmp f128" {
43 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
44 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
45 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
46 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
47 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
48
49 try testCmp(f128);
50 try comptime testCmp(f128);
51}
52
53test "cmp f80/c_longdouble" {
54 if (true) return error.SkipZigTest;
55
56 try testCmp(f80);
57 try comptime testCmp(f80);
58 try testCmp(c_longdouble);
59 try comptime testCmp(c_longdouble);
60}
61
62fn testCmp(comptime T: type) !void {
63 {
3164 // No decimal part
32 {
33 const x: T = 1.0;
34 try expect(x == 1);
35 try expect(x != 0);
36 try expect(x > 0);
37 try expect(x < 2);
38 try expect(x >= 1);
39 try expect(x <= 1);
40 }
65 var x: T = 1.0;
66 try expect(x == 1.0);
67 try expect(x != 0.0);
68 try expect(x > 0.0);
69 try expect(x < 2.0);
70 try expect(x >= 1.0);
71 try expect(x <= 1.0);
72 }
73 {
4174 // Non-zero decimal part
42 {
43 const x: T = 1.5;
44 try expect(x != 1);
45 try expect(x != 2);
46 try expect(x > 1);
47 try expect(x < 2);
48 try expect(x >= 1);
49 try expect(x <= 2);
75 var x: T = 1.5;
76 try expect(x != 1.0);
77 try expect(x != 2.0);
78 try expect(x > 1.0);
79 try expect(x < 2.0);
80 try expect(x >= 1.0);
81 try expect(x <= 2.0);
82 }
83
84 @setEvalBranchQuota(2_000);
85 var edges = [_]T{
86 -math.inf(T),
87 -math.floatMax(T),
88 -math.floatMin(T),
89 -math.floatTrueMin(T),
90 -0.0,
91 math.nan(T),
92 0.0,
93 math.floatTrueMin(T),
94 math.floatMin(T),
95 math.floatMax(T),
96 math.inf(T),
97 };
98 for (edges, 0..) |rhs, rhs_i| {
99 for (edges, 0..) |lhs, lhs_i| {
100 const no_nan = lhs_i != 5 and rhs_i != 5;
101 const lhs_order = if (lhs_i < 5) lhs_i else lhs_i - 2;
102 const rhs_order = if (rhs_i < 5) rhs_i else rhs_i - 2;
103 try expect((lhs == rhs) == (no_nan and lhs_order == rhs_order));
104 try expect((lhs != rhs) == !(no_nan and lhs_order == rhs_order));
105 try expect((lhs < rhs) == (no_nan and lhs_order < rhs_order));
106 try expect((lhs > rhs) == (no_nan and lhs_order > rhs_order));
107 try expect((lhs <= rhs) == (no_nan and lhs_order <= rhs_order));
108 try expect((lhs >= rhs) == (no_nan and lhs_order >= rhs_order));
50109 }
51110 }
52111}
......@@ -68,27 +127,6 @@ fn testDifferentSizedFloatComparisons() !void {
68127 try expect(a < b);
69128}
70129
71test "f80 comparisons" {
72 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
73 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
74 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
75 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
76 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
77
78 try expect(compareF80(0.0, .eq, -0.0));
79 try expect(compareF80(0.0, .lte, -0.0));
80 try expect(compareF80(0.0, .gte, -0.0));
81 try expect(compareF80(1.0, .neq, -1.0));
82 try expect(compareF80(2.0, .lt, 4.0));
83 try expect(compareF80(2.0, .lte, 4.0));
84 try expect(compareF80(-2.0, .gt, -4.0));
85 try expect(compareF80(-2.0, .gte, -4.0));
86}
87
88fn compareF80(x: f80, op: math.CompareOperator, y: f80) bool {
89 return math.compare(x, op, y);
90}
91
92130// TODO This is waiting on library support for the Windows build (not sure why the other's don't need it)
93131//test "@nearbyint" {
94132// comptime testNearbyInt();
......@@ -234,8 +272,8 @@ test "@sin f16" {
234272 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
235273 if (no_x86_64_hardware_f16_support) return error.SkipZigTest;
236274
237 try testSin(&.{f16});
238 try comptime testSin(&.{f16});
275 try testSin(f16);
276 try comptime testSin(f16);
239277}
240278
241279test "@sin f32/f64" {
......@@ -245,8 +283,10 @@ test "@sin f32/f64" {
245283 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
246284 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
247285
248 try testSin(&.{ f32, f64 });
249 try comptime testSin(&.{ f32, f64 });
286 try testSin(f32);
287 comptime try testSin(f32);
288 try testSin(f64);
289 comptime try testSin(f64);
250290}
251291
252292test "@sin f80/f128/c_longdouble" {
......@@ -256,20 +296,22 @@ test "@sin f80/f128/c_longdouble" {
256296 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
257297 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
258298
259 try testSin(&.{ f80, f128, c_longdouble });
260 try comptime testSin(&.{ f80, f128, c_longdouble });
299 try testSin(f80);
300 comptime try testSin(f80);
301 try testSin(f128);
302 comptime try testSin(f128);
303 try testSin(c_longdouble);
304 comptime try testSin(c_longdouble);
261305}
262306
263fn testSin(comptime Ts: []const type) !void {
264 inline for (Ts) |T| {
265 const eps = epsForType(T);
266 var zero: T = 0;
267 try expect(@sin(zero) == 0);
268 var pi: T = std.math.pi;
269 try expect(math.approxEqAbs(T, @sin(pi), 0, eps));
270 try expect(math.approxEqAbs(T, @sin(pi / 2.0), 1, eps));
271 try expect(math.approxEqAbs(T, @sin(pi / 4.0), 0.7071067811865475, eps));
272 }
307fn testSin(comptime T: type) !void {
308 const eps = epsForType(T);
309 var zero: T = 0;
310 try expect(@sin(zero) == 0);
311 var pi: T = math.pi;
312 try expect(math.approxEqAbs(T, @sin(pi), 0, eps));
313 try expect(math.approxEqAbs(T, @sin(pi / 2.0), 1, eps));
314 try expect(math.approxEqAbs(T, @sin(pi / 4.0), 0.7071067811865475, eps));
273315}
274316
275317test "@sin with vectors" {
......@@ -300,8 +342,8 @@ test "@cos f16" {
300342 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
301343 if (no_x86_64_hardware_f16_support) return error.SkipZigTest;
302344
303 try testCos(&.{f16});
304 try comptime testCos(&.{f16});
345 try testCos(f16);
346 try comptime testCos(f16);
305347}
306348
307349test "@cos f32/f64" {
......@@ -311,8 +353,10 @@ test "@cos f32/f64" {
311353 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
312354 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
313355
314 try testCos(&.{ f32, f64 });
315 try comptime testCos(&.{ f32, f64 });
356 try testCos(f32);
357 try comptime testCos(f32);
358 try testCos(f64);
359 try comptime testCos(f64);
316360}
317361
318362test "@cos f80/f128/c_longdouble" {
......@@ -322,20 +366,22 @@ test "@cos f80/f128/c_longdouble" {
322366 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
323367 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
324368
325 try testCos(&.{ f80, f128, c_longdouble });
326 try comptime testCos(&.{ f80, f128, c_longdouble });
369 try testCos(f80);
370 try comptime testCos(f80);
371 try testCos(f128);
372 try comptime testCos(f128);
373 try testCos(c_longdouble);
374 try comptime testCos(c_longdouble);
327375}
328376
329fn testCos(comptime Ts: []const type) !void {
330 inline for (Ts) |T| {
331 const eps = epsForType(T);
332 var zero: T = 0;
333 try expect(@cos(zero) == 1);
334 var pi: T = std.math.pi;
335 try expect(math.approxEqAbs(T, @cos(pi), -1, eps));
336 try expect(math.approxEqAbs(T, @cos(pi / 2.0), 0, eps));
337 try expect(math.approxEqAbs(T, @cos(pi / 4.0), 0.7071067811865475, eps));
338 }
377fn testCos(comptime T: type) !void {
378 const eps = epsForType(T);
379 var zero: T = 0;
380 try expect(@cos(zero) == 1);
381 var pi: T = math.pi;
382 try expect(math.approxEqAbs(T, @cos(pi), -1, eps));
383 try expect(math.approxEqAbs(T, @cos(pi / 2.0), 0, eps));
384 try expect(math.approxEqAbs(T, @cos(pi / 4.0), 0.7071067811865475, eps));
339385}
340386
341387test "@cos with vectors" {
......@@ -366,8 +412,8 @@ test "@tan f16" {
366412 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
367413 if (no_x86_64_hardware_f16_support) return error.SkipZigTest;
368414
369 try testTan(&.{f16});
370 try comptime testTan(&.{f16});
415 try testTan(f16);
416 try comptime testTan(f16);
371417}
372418
373419test "@tan f32/f64" {
......@@ -377,8 +423,10 @@ test "@tan f32/f64" {
377423 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
378424 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
379425
380 try testTan(&.{ f32, f64 });
381 try comptime testTan(&.{ f32, f64 });
426 try testTan(f32);
427 try comptime testTan(f32);
428 try testTan(f64);
429 try comptime testTan(f64);
382430}
383431
384432test "@tan f80/f128/c_longdouble" {
......@@ -388,20 +436,22 @@ test "@tan f80/f128/c_longdouble" {
388436 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
389437 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
390438
391 try testTan(&.{ f80, f128, c_longdouble });
392 try comptime testTan(&.{ f80, f128, c_longdouble });
439 try testTan(f80);
440 try comptime testTan(f80);
441 try testTan(f128);
442 try comptime testTan(f128);
443 try testTan(c_longdouble);
444 try comptime testTan(c_longdouble);
393445}
394446
395fn testTan(comptime Ts: []const type) !void {
396 inline for (Ts) |T| {
397 const eps = epsForType(T);
398 var zero: T = 0;
399 try expect(@tan(zero) == 0);
400 var pi: T = std.math.pi;
401 try expect(math.approxEqAbs(T, @tan(pi), 0, eps));
402 try expect(math.approxEqAbs(T, @tan(pi / 3.0), 1.732050807568878, eps));
403 try expect(math.approxEqAbs(T, @tan(pi / 4.0), 1, eps));
404 }
447fn testTan(comptime T: type) !void {
448 const eps = epsForType(T);
449 var zero: T = 0;
450 try expect(@tan(zero) == 0);
451 var pi: T = math.pi;
452 try expect(math.approxEqAbs(T, @tan(pi), 0, eps));
453 try expect(math.approxEqAbs(T, @tan(pi / 3.0), 1.732050807568878, eps));
454 try expect(math.approxEqAbs(T, @tan(pi / 4.0), 1, eps));
405455}
406456
407457test "@tan with vectors" {
......@@ -432,8 +482,8 @@ test "@exp f16" {
432482 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
433483 if (no_x86_64_hardware_f16_support) return error.SkipZigTest;
434484
435 try testExp(&.{f16});
436 try comptime testExp(&.{f16});
485 try testExp(f16);
486 try comptime testExp(f16);
437487}
438488
439489test "@exp f32/f64" {
......@@ -443,8 +493,10 @@ test "@exp f32/f64" {
443493 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
444494 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
445495
446 try testExp(&.{ f32, f64 });
447 try comptime testExp(&.{ f32, f64 });
496 try testExp(f32);
497 try comptime testExp(f32);
498 try testExp(f64);
499 try comptime testExp(f64);
448500}
449501
450502test "@exp f80/f128/c_longdouble" {
......@@ -454,20 +506,22 @@ test "@exp f80/f128/c_longdouble" {
454506 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
455507 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
456508
457 try testExp(&.{ f80, f128, c_longdouble });
458 try comptime testExp(&.{ f80, f128, c_longdouble });
509 try testExp(f80);
510 try comptime testExp(f80);
511 try testExp(f128);
512 try comptime testExp(f128);
513 try testExp(c_longdouble);
514 try comptime testExp(c_longdouble);
459515}
460516
461fn testExp(comptime Ts: []const type) !void {
462 inline for (Ts) |T| {
463 const eps = epsForType(T);
464 var zero: T = 0;
465 try expect(@exp(zero) == 1);
466 var two: T = 2;
467 try expect(math.approxEqAbs(T, @exp(two), 7.389056098930650, eps));
468 var five: T = 5;
469 try expect(math.approxEqAbs(T, @exp(five), 148.4131591025766, eps));
470 }
517fn testExp(comptime T: type) !void {
518 const eps = epsForType(T);
519 var zero: T = 0;
520 try expect(@exp(zero) == 1);
521 var two: T = 2;
522 try expect(math.approxEqAbs(T, @exp(two), 7.389056098930650, eps));
523 var five: T = 5;
524 try expect(math.approxEqAbs(T, @exp(five), 148.4131591025766, eps));
471525}
472526
473527test "@exp with vectors" {
......@@ -498,8 +552,8 @@ test "@exp2 f16" {
498552 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
499553 if (no_x86_64_hardware_f16_support) return error.SkipZigTest;
500554
501 try testExp2(&.{f16});
502 try comptime testExp2(&.{f16});
555 try testExp2(f16);
556 try comptime testExp2(f16);
503557}
504558
505559test "@exp2 f32/f64" {
......@@ -509,8 +563,10 @@ test "@exp2 f32/f64" {
509563 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
510564 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
511565
512 try testExp2(&.{ f32, f64 });
513 try comptime testExp2(&.{ f32, f64 });
566 try testExp2(f32);
567 try comptime testExp2(f32);
568 try testExp2(f64);
569 try comptime testExp2(f64);
514570}
515571
516572test "@exp2 f80/f128/c_longdouble" {
......@@ -520,20 +576,22 @@ test "@exp2 f80/f128/c_longdouble" {
520576 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
521577 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
522578
523 try testExp2(&.{ f80, f128, c_longdouble });
524 try comptime testExp2(&.{ f80, f128, c_longdouble });
579 try testExp2(f80);
580 try comptime testExp2(f80);
581 try testExp2(f128);
582 try comptime testExp2(f128);
583 try testExp2(c_longdouble);
584 try comptime testExp2(c_longdouble);
525585}
526586
527fn testExp2(comptime Ts: []const type) !void {
528 inline for (Ts) |T| {
529 const eps = epsForType(T);
530 var two: T = 2;
531 try expect(@exp2(two) == 4);
532 var one_point_five: T = 1.5;
533 try expect(math.approxEqAbs(T, @exp2(one_point_five), 2.8284271247462, eps));
534 var four_point_five: T = 4.5;
535 try expect(math.approxEqAbs(T, @exp2(four_point_five), 22.627416997969, eps));
536 }
587fn testExp2(comptime T: type) !void {
588 const eps = epsForType(T);
589 var two: T = 2;
590 try expect(@exp2(two) == 4);
591 var one_point_five: T = 1.5;
592 try expect(math.approxEqAbs(T, @exp2(one_point_five), 2.8284271247462, eps));
593 var four_point_five: T = 4.5;
594 try expect(math.approxEqAbs(T, @exp2(four_point_five), 22.627416997969, eps));
537595}
538596
539597test "@exp2 with @vectors" {
......@@ -564,8 +622,8 @@ test "@log f16" {
564622 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
565623 if (no_x86_64_hardware_f16_support) return error.SkipZigTest;
566624
567 try testLog(&.{f16});
568 try comptime testLog(&.{f16});
625 try testLog(f16);
626 try comptime testLog(f16);
569627}
570628
571629test "@log f32/f64" {
......@@ -575,8 +633,10 @@ test "@log f32/f64" {
575633 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
576634 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
577635
578 try testLog(&.{ f32, f64 });
579 try comptime testLog(&.{ f32, f64 });
636 try testLog(f32);
637 try comptime testLog(f32);
638 try testLog(f64);
639 try comptime testLog(f64);
580640}
581641
582642test "@log f80/f128/c_longdouble" {
......@@ -586,20 +646,22 @@ test "@log f80/f128/c_longdouble" {
586646 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
587647 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
588648
589 try testLog(&.{ f80, f128, c_longdouble });
590 try comptime testLog(&.{ f80, f128, c_longdouble });
649 try testLog(f80);
650 try comptime testLog(f80);
651 try testLog(f128);
652 try comptime testLog(f128);
653 try testLog(c_longdouble);
654 try comptime testLog(c_longdouble);
591655}
592656
593fn testLog(comptime Ts: []const type) !void {
594 inline for (Ts) |T| {
595 const eps = epsForType(T);
596 var e: T = std.math.e;
597 try expect(math.approxEqAbs(T, @log(e), 1, eps));
598 var two: T = 2;
599 try expect(math.approxEqAbs(T, @log(two), 0.6931471805599, eps));
600 var five: T = 5;
601 try expect(math.approxEqAbs(T, @log(five), 1.6094379124341, eps));
602 }
657fn testLog(comptime T: type) !void {
658 const eps = epsForType(T);
659 var e: T = math.e;
660 try expect(math.approxEqAbs(T, @log(e), 1, eps));
661 var two: T = 2;
662 try expect(math.approxEqAbs(T, @log(two), 0.6931471805599, eps));
663 var five: T = 5;
664 try expect(math.approxEqAbs(T, @log(five), 1.6094379124341, eps));
603665}
604666
605667test "@log with @vectors" {
......@@ -628,8 +690,8 @@ test "@log2 f16" {
628690 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
629691 if (no_x86_64_hardware_f16_support) return error.SkipZigTest;
630692
631 try testLog2(&.{f16});
632 try comptime testLog2(&.{f16});
693 try testLog2(f16);
694 try comptime testLog2(f16);
633695}
634696
635697test "@log2 f32/f64" {
......@@ -639,8 +701,10 @@ test "@log2 f32/f64" {
639701 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
640702 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
641703
642 try testLog2(&.{ f32, f64 });
643 try comptime testLog2(&.{ f32, f64 });
704 try testLog2(f32);
705 try comptime testLog2(f32);
706 try testLog2(f64);
707 try comptime testLog2(f64);
644708}
645709
646710test "@log2 f80/f128/c_longdouble" {
......@@ -650,20 +714,22 @@ test "@log2 f80/f128/c_longdouble" {
650714 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
651715 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
652716
653 try testLog2(&.{ f80, f128, c_longdouble });
654 try comptime testLog2(&.{ f80, f128, c_longdouble });
717 try testLog2(f80);
718 try comptime testLog2(f80);
719 try testLog2(f128);
720 try comptime testLog2(f128);
721 try testLog2(c_longdouble);
722 try comptime testLog2(c_longdouble);
655723}
656724
657fn testLog2(comptime Ts: []const type) !void {
658 inline for (Ts) |T| {
659 const eps = epsForType(T);
660 var four: T = 4;
661 try expect(@log2(four) == 2);
662 var six: T = 6;
663 try expect(math.approxEqAbs(T, @log2(six), 2.5849625007212, eps));
664 var ten: T = 10;
665 try expect(math.approxEqAbs(T, @log2(ten), 3.3219280948874, eps));
666 }
725fn testLog2(comptime T: type) !void {
726 const eps = epsForType(T);
727 var four: T = 4;
728 try expect(@log2(four) == 2);
729 var six: T = 6;
730 try expect(math.approxEqAbs(T, @log2(six), 2.5849625007212, eps));
731 var ten: T = 10;
732 try expect(math.approxEqAbs(T, @log2(ten), 3.3219280948874, eps));
667733}
668734
669735test "@log2 with vectors" {
......@@ -698,8 +764,8 @@ test "@log10 f16" {
698764 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
699765 if (no_x86_64_hardware_f16_support) return error.SkipZigTest;
700766
701 try testLog10(&.{f16});
702 try comptime testLog10(&.{f16});
767 try testLog10(f16);
768 try comptime testLog10(f16);
703769}
704770
705771test "@log10 f32/f64" {
......@@ -709,8 +775,10 @@ test "@log10 f32/f64" {
709775 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
710776 if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
711777
712 try testLog10(&.{ f32, f64 });
713 try comptime testLog10(&.{ f32, f64 });
778 try testLog10(f32);
779 try comptime testLog10(f32);
780 try testLog10(f64);
781 try comptime testLog10(f64);
714782}
715783
716784test "@log10 f80/f128/c_longdouble" {
......@@ -720,20 +788,22 @@ test "@log10 f80/f128/c_longdouble" {
720788 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
721789 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
722790
723 try testLog10(&.{ f80, f128, c_longdouble });
724 try comptime testLog10(&.{ f80, f128, c_longdouble });
791 try testLog10(f80);
792 try comptime testLog10(f80);
793 try testLog10(f128);
794 try comptime testLog10(f128);
795 try testLog10(c_longdouble);
796 try comptime testLog10(c_longdouble);
725797}
726798
727fn testLog10(comptime Ts: []const type) !void {
728 inline for (Ts) |T| {
729 const eps = epsForType(T);
730 var hundred: T = 100;
731 try expect(@log10(hundred) == 2);
732 var fifteen: T = 15;
733 try expect(math.approxEqAbs(T, @log10(fifteen), 1.176091259056, eps));
734 var fifty: T = 50;
735 try expect(math.approxEqAbs(T, @log10(fifty), 1.698970004336, eps));
736 }
799fn testLog10(comptime T: type) !void {
800 const eps = epsForType(T);
801 var hundred: T = 100;
802 try expect(@log10(hundred) == 2);
803 var fifteen: T = 15;
804 try expect(math.approxEqAbs(T, @log10(fifteen), 1.176091259056, eps));
805 var fifty: T = 50;
806 try expect(math.approxEqAbs(T, @log10(fifty), 1.698970004336, eps));
737807}
738808
739809test "@log10 with vectors" {
......@@ -756,38 +826,91 @@ fn testLog10WithVectors() !void {
756826 try expect(@log10(@as(f32, 0.4)) == result[3]);
757827}
758828
759test "@abs" {
829test "@abs f16" {
760830 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
761831 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
762832 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
833 if (no_x86_64_hardware_f16_support) return error.SkipZigTest;
763834
764 try testFabs();
765 try comptime testFabs();
835 try testFabs(f16);
836 try comptime testFabs(f16);
766837}
767838
768fn testFabs() !void {
769 try expect(@abs(@as(f16, -2.5)) == 2.5);
770 try expect(@abs(@as(f16, 2.5)) == 2.5);
771 try expect(@abs(@as(f32, -2.5)) == 2.5);
772 try expect(@abs(@as(f32, 2.5)) == 2.5);
773 try expect(@abs(@as(f64, -2.5)) == 2.5);
774 try expect(@abs(@as(f64, 2.5)) == 2.5);
839test "@abs f32/f64" {
840 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
841 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
842 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
775843
776 // TODO test f128, and c_longdouble
777 // https://github.com/ziglang/zig/issues/4026
778 // {
779 // var a: f80 = -2.5;
780 // var b: f80 = 2.5;
781 // try expect(@abs(a) == 2.5);
782 // try expect(@abs(b) == 2.5);
783 // }
844 try testFabs(f32);
845 try comptime testFabs(f32);
846 try testFabs(f64);
847 try comptime testFabs(f64);
784848}
785849
786test "@abs with vectors" {
787 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
850test "@abs f80/f128/c_longdouble" {
788851 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
789852 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
853 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
854 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
855 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
856
857 try testFabs(f80);
858 try comptime testFabs(f80);
859 try testFabs(f128);
860 try comptime testFabs(f128);
861 try testFabs(c_longdouble);
862 try comptime testFabs(c_longdouble);
863}
864
865fn testFabs(comptime T: type) !void {
866 var two_point_five: T = 2.5;
867 try expect(@abs(two_point_five) == 2.5);
868 var neg_two_point_five: T = -2.5;
869 try expect(@abs(neg_two_point_five) == 2.5);
870
871 var twelve: T = 12.0;
872 try expect(@abs(twelve) == 12.0);
873 var neg_fourteen: T = -14.0;
874 try expect(@abs(neg_fourteen) == 14.0);
875
876 // normals
877 var one: T = 1.0;
878 try expect(@abs(one) == 1.0);
879 var neg_one: T = -1.0;
880 try expect(@abs(neg_one) == 1.0);
881 var min: T = math.floatMin(T);
882 try expect(@abs(min) == math.floatMin(T));
883 var neg_min: T = -math.floatMin(T);
884 try expect(@abs(neg_min) == math.floatMin(T));
885 var max: T = math.floatMax(T);
886 try expect(@abs(max) == math.floatMax(T));
887 var neg_max: T = -math.floatMax(T);
888 try expect(@abs(neg_max) == math.floatMax(T));
889
890 // subnormals
891 var zero: T = 0.0;
892 try expect(@abs(zero) == 0.0);
893 var neg_zero: T = -0.0;
894 try expect(@abs(neg_zero) == 0.0);
895 var true_min: T = math.floatTrueMin(T);
896 try expect(@abs(true_min) == math.floatTrueMin(T));
897 var neg_true_min: T = -math.floatTrueMin(T);
898 try expect(@abs(neg_true_min) == math.floatTrueMin(T));
899
900 // non-finite numbers
901 var inf: T = math.inf(T);
902 try expect(math.isPositiveInf(@abs(inf)));
903 var neg_inf: T = -math.inf(T);
904 try expect(math.isPositiveInf(@abs(neg_inf)));
905 var nan: T = math.nan(T);
906 try expect(math.isNan(@abs(nan)));
907}
908
909test "@abs with vectors" {
910 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
911 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
790912 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
913 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
791914
792915 try testFabsWithVectors();
793916 try comptime testFabsWithVectors();
......@@ -802,104 +925,72 @@ fn testFabsWithVectors() !void {
802925 try expect(math.approxEqAbs(f32, @abs(@as(f32, -0.4)), result[3], epsilon));
803926}
804927
805test "another, possibly redundant, @abs test" {
806 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
807 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
928test "@floor f16" {
808929 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
809 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
810 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
930 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
931 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
811932 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
812933
813 try testFabsLegacy(f128, 12.0);
814 try comptime testFabsLegacy(f128, 12.0);
815 try testFabsLegacy(f64, 12.0);
816 try comptime testFabsLegacy(f64, 12.0);
817 try testFabsLegacy(f32, 12.0);
818 try comptime testFabsLegacy(f32, 12.0);
819 try testFabsLegacy(f16, 12.0);
820 try comptime testFabsLegacy(f16, 12.0);
821
822 const x = 14.0;
823 const y = -x;
824 const z = @abs(y);
825 try comptime std.testing.expectEqual(x, z);
934 try testFloor(f16);
935 try comptime testFloor(f16);
826936}
827937
828test "@abs f80" {
829 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
830 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
938test "@floor f32/f64" {
831939 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
832 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
833 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
834 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
835
836 try testFabsLegacy(f80, 12.0);
837 try comptime testFabsLegacy(f80, 12.0);
838}
940 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
941 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
942 if (builtin.zig_backend == .stage2_x86_64 and (builtin.target.ofmt != .elf or !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .sse4_1))) return error.SkipZigTest;
839943
840fn testFabsLegacy(comptime T: type, x: T) !void {
841 const y = -x;
842 const z = @abs(y);
843 try expect(x == z);
944 try testFloor(f32);
945 try comptime testFloor(f32);
946 try testFloor(f64);
947 try comptime testFloor(f64);
844948}
845949
846test "a third @abs test, surely there should not be three fabs tests" {
847 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
848 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
950test "@floor f80/f128/c_longdouble" {
849951 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
850 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
952 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
851953 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
954 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
852955 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
853956
854 inline for ([_]type{ f16, f32, f64, f80, f128, c_longdouble }) |T| {
855 // normals
856 try expect(@abs(@as(T, 1.0)) == 1.0);
857 try expect(@abs(@as(T, -1.0)) == 1.0);
858 try expect(@abs(math.floatMin(T)) == math.floatMin(T));
859 try expect(@abs(-math.floatMin(T)) == math.floatMin(T));
860 try expect(@abs(math.floatMax(T)) == math.floatMax(T));
861 try expect(@abs(-math.floatMax(T)) == math.floatMax(T));
862
863 // subnormals
864 try expect(@abs(@as(T, 0.0)) == 0.0);
865 try expect(@abs(@as(T, -0.0)) == 0.0);
866 try expect(@abs(math.floatTrueMin(T)) == math.floatTrueMin(T));
867 try expect(@abs(-math.floatTrueMin(T)) == math.floatTrueMin(T));
868
869 // non-finite numbers
870 try expect(math.isPositiveInf(@abs(math.inf(T))));
871 try expect(math.isPositiveInf(@abs(-math.inf(T))));
872 try expect(math.isNan(@abs(math.nan(T))));
957 if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) {
958 // https://github.com/ziglang/zig/issues/12602
959 return error.SkipZigTest;
873960 }
874}
875961
876test "@floor" {
877 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
878 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
879 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
880
881 try testFloor();
882 try comptime testFloor();
883}
884
885fn testFloor() !void {
886 try expect(@floor(@as(f16, 2.1)) == 2);
887 try expect(@floor(@as(f32, 2.1)) == 2);
888 try expect(@floor(@as(f64, 3.5)) == 3);
889
890 // TODO test f128, and c_longdouble
891 // https://github.com/ziglang/zig/issues/4026
892 // {
893 // var a: f80 = 3.5;
894 // try expect(@floor(a) == 3);
895 // }
962 try testFloor(f80);
963 try comptime testFloor(f80);
964 try testFloor(f128);
965 try comptime testFloor(f128);
966 try testFloor(c_longdouble);
967 try comptime testFloor(c_longdouble);
968}
969
970fn testFloor(comptime T: type) !void {
971 var two_point_one: T = 2.1;
972 try expect(@floor(two_point_one) == 2.0);
973 var neg_two_point_one: T = -2.1;
974 try expect(@floor(neg_two_point_one) == -3.0);
975 var three_point_five: T = 3.5;
976 try expect(@floor(three_point_five) == 3.0);
977 var neg_three_point_five: T = -3.5;
978 try expect(@floor(neg_three_point_five) == -4.0);
979 var twelve: T = 12.0;
980 try expect(@floor(twelve) == 12.0);
981 var neg_twelve: T = -12.0;
982 try expect(@floor(neg_twelve) == -12.0);
983 var fourteen_point_seven: T = 14.7;
984 try expect(@floor(fourteen_point_seven) == 14.0);
985 var neg_fourteen_point_seven: T = -14.7;
986 try expect(@floor(neg_fourteen_point_seven) == -15.0);
896987}
897988
898989test "@floor with vectors" {
899 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
900 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
901990 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
991 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
902992 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
993 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
903994 if (builtin.zig_backend == .stage2_x86_64 and
904995 !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .sse4_1)) return error.SkipZigTest;
905996
......@@ -916,30 +1007,33 @@ fn testFloorWithVectors() !void {
9161007 try expect(math.approxEqAbs(f32, @floor(@as(f32, -0.4)), result[3], epsilon));
9171008}
9181009
919test "another, possibly redundant, @floor test" {
920 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1010test "@ceil f16" {
9211011 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
922 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1012 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1013 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
9231014 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
9241015
925 try testFloorLegacy(f64, 12.0);
926 try comptime testFloorLegacy(f64, 12.0);
927 try testFloorLegacy(f32, 12.0);
928 try comptime testFloorLegacy(f32, 12.0);
929 try testFloorLegacy(f16, 12.0);
930 try comptime testFloorLegacy(f16, 12.0);
931
932 const x = 14.0;
933 const y = x + 0.7;
934 const z = @floor(y);
935 try comptime expect(x == z);
1016 try testCeil(f16);
1017 try comptime testCeil(f16);
9361018}
9371019
938test "@floor f80" {
1020test "@ceil f32/f64" {
1021 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
9391022 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1023 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1024 if (builtin.zig_backend == .stage2_x86_64 and (builtin.target.ofmt != .elf or !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .sse4_1))) return error.SkipZigTest;
1025
1026 try testCeil(f32);
1027 try comptime testCeil(f32);
1028 try testCeil(f64);
1029 try comptime testCeil(f64);
1030}
1031
1032test "@ceil f80/f128/c_longdouble" {
9401033 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
941 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1034 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
9421035 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
1036 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
9431037 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
9441038
9451039 if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) {
......@@ -947,54 +1041,38 @@ test "@floor f80" {
9471041 return error.SkipZigTest;
9481042 }
9491043
950 try testFloorLegacy(f80, 12.0);
951 try comptime testFloorLegacy(f80, 12.0);
952}
953
954test "@floor f128" {
955 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
956 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
957 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
958 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
959 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
960
961 try testFloorLegacy(f128, 12.0);
962 try comptime testFloorLegacy(f128, 12.0);
963}
964
965fn testFloorLegacy(comptime T: type, x: T) !void {
966 const y = x + 0.6;
967 const z = @floor(y);
968 try expect(x == z);
969}
970
971test "@ceil" {
972 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
973 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
974 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
975
976 try testCeil();
977 try comptime testCeil();
978}
979
980fn testCeil() !void {
981 try expect(@ceil(@as(f16, 2.1)) == 3);
982 try expect(@ceil(@as(f32, 2.1)) == 3);
983 try expect(@ceil(@as(f64, 3.5)) == 4);
984
985 // TODO test f128, and c_longdouble
986 // https://github.com/ziglang/zig/issues/4026
987 // {
988 // var a: f80 = 3.5;
989 // try expect(@ceil(a) == 4);
990 // }
1044 try testCeil(f80);
1045 try comptime testCeil(f80);
1046 try testCeil(f128);
1047 try comptime testCeil(f128);
1048 try testCeil(c_longdouble);
1049 try comptime testCeil(c_longdouble);
1050}
1051
1052fn testCeil(comptime T: type) !void {
1053 var two_point_one: T = 2.1;
1054 try expect(@ceil(two_point_one) == 3.0);
1055 var neg_two_point_one: T = -2.1;
1056 try expect(@ceil(neg_two_point_one) == -2.0);
1057 var three_point_five: T = 3.5;
1058 try expect(@ceil(three_point_five) == 4.0);
1059 var neg_three_point_five: T = -3.5;
1060 try expect(@ceil(neg_three_point_five) == -3.0);
1061 var twelve: T = 12.0;
1062 try expect(@ceil(twelve) == 12.0);
1063 var neg_twelve: T = -12.0;
1064 try expect(@ceil(neg_twelve) == -12.0);
1065 var fourteen_point_seven: T = 14.7;
1066 try expect(@ceil(fourteen_point_seven) == 15.0);
1067 var neg_fourteen_point_seven: T = -14.7;
1068 try expect(@ceil(neg_fourteen_point_seven) == -14.0);
9911069}
9921070
9931071test "@ceil with vectors" {
994 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
995 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
9961072 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1073 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
9971074 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1075 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
9981076 if (builtin.zig_backend == .stage2_x86_64 and
9991077 !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .sse4_1)) return error.SkipZigTest;
10001078
......@@ -1011,78 +1089,75 @@ fn testCeilWithVectors() !void {
10111089 try expect(math.approxEqAbs(f32, @ceil(@as(f32, -0.4)), result[3], epsilon));
10121090}
10131091
1014test "another, possibly redundant, @ceil test" {
1015 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1092test "@trunc f16" {
10161093 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1017 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1018 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1019
1020 try testCeilLegacy(f64, 12.0);
1021 try comptime testCeilLegacy(f64, 12.0);
1022 try testCeilLegacy(f32, 12.0);
1023 try comptime testCeilLegacy(f32, 12.0);
1024 try testCeilLegacy(f16, 12.0);
1025 try comptime testCeilLegacy(f16, 12.0);
1026
1027 const x = 14.0;
1028 const y = x - 0.7;
1029 const z = @ceil(y);
1030 try comptime expect(x == z);
1031}
1032
1033test "@ceil f80" {
10341094 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1035 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1036 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1037 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
1095 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
10381096 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
10391097
1040 if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) {
1041 // https://github.com/ziglang/zig/issues/12602
1098 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isMIPS()) {
1099 // https://github.com/ziglang/zig/issues/16846
10421100 return error.SkipZigTest;
10431101 }
10441102
1045 try testCeilLegacy(f80, 12.0);
1046 try comptime testCeilLegacy(f80, 12.0);
1103 try testTrunc(f16);
1104 try comptime testTrunc(f16);
10471105}
10481106
1049test "@ceil f128" {
1050 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1107test "@trunc f32/f64" {
10511108 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1052 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1053 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
1054 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1109 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1110 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1111 if (builtin.zig_backend == .stage2_x86_64 and (builtin.target.ofmt != .elf or !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .sse4_1))) return error.SkipZigTest;
10551112
1056 try testCeilLegacy(f128, 12.0);
1057 try comptime testCeilLegacy(f128, 12.0);
1058}
1113 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isMIPS()) {
1114 // https://github.com/ziglang/zig/issues/16846
1115 return error.SkipZigTest;
1116 }
10591117
1060fn testCeilLegacy(comptime T: type, x: T) !void {
1061 const y = x - 0.8;
1062 const z = @ceil(y);
1063 try expect(x == z);
1118 try testTrunc(f32);
1119 try comptime testTrunc(f32);
1120 try testTrunc(f64);
1121 try comptime testTrunc(f64);
10641122}
10651123
1066test "@trunc" {
1067 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1124test "@trunc f80/f128/c_longdouble" {
10681125 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1126 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1127 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
10691128 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1129 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
10701130
1071 try testTrunc();
1072 try comptime testTrunc();
1073}
1074
1075fn testTrunc() !void {
1076 try expect(@trunc(@as(f16, 2.1)) == 2);
1077 try expect(@trunc(@as(f32, 2.1)) == 2);
1078 try expect(@trunc(@as(f64, -3.5)) == -3);
1131 if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) {
1132 // https://github.com/ziglang/zig/issues/12602
1133 return error.SkipZigTest;
1134 }
10791135
1080 // TODO test f128, and c_longdouble
1081 // https://github.com/ziglang/zig/issues/4026
1082 // {
1083 // var a: f80 = -3.5;
1084 // try expect(@trunc(a) == -3);
1085 // }
1136 try testTrunc(f80);
1137 try comptime testTrunc(f80);
1138 try testTrunc(f128);
1139 try comptime testTrunc(f128);
1140 try testTrunc(c_longdouble);
1141 try comptime testTrunc(c_longdouble);
1142}
1143
1144fn testTrunc(comptime T: type) !void {
1145 var two_point_one: T = 2.1;
1146 try expect(@trunc(two_point_one) == 2.0);
1147 var neg_two_point_one: T = -2.1;
1148 try expect(@trunc(neg_two_point_one) == -2.0);
1149 var three_point_five: T = 3.5;
1150 try expect(@trunc(three_point_five) == 3.0);
1151 var neg_three_point_five: T = -3.5;
1152 try expect(@trunc(neg_three_point_five) == -3.0);
1153 var twelve: T = 12.0;
1154 try expect(@trunc(twelve) == 12.0);
1155 var neg_twelve: T = -12.0;
1156 try expect(@trunc(neg_twelve) == -12.0);
1157 var fourteen_point_seven: T = 14.7;
1158 try expect(@trunc(fourteen_point_seven) == 14.0);
1159 var neg_fourteen_point_seven: T = -14.7;
1160 try expect(@trunc(neg_fourteen_point_seven) == -14.0);
10861161}
10871162
10881163test "@trunc with vectors" {
......@@ -1106,82 +1181,12 @@ fn testTruncWithVectors() !void {
11061181 try expect(math.approxEqAbs(f32, @trunc(@as(f32, -0.4)), result[3], epsilon));
11071182}
11081183
1109test "another, possibly redundant, @trunc test" {
1110 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1184test "neg f16" {
11111185 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1112 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1113 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1114
1115 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch.isMIPS()) {
1116 // https://github.com/ziglang/zig/issues/16846
1117 return error.SkipZigTest;
1118 }
1119
1120 try testTruncLegacy(f64, 12.0);
1121 try comptime testTruncLegacy(f64, 12.0);
1122 try testTruncLegacy(f32, 12.0);
1123 try comptime testTruncLegacy(f32, 12.0);
1124 try testTruncLegacy(f16, 12.0);
1125 try comptime testTruncLegacy(f16, 12.0);
1126
1127 const x = 14.0;
1128 const y = x + 0.7;
1129 const z = @trunc(y);
1130 try comptime expect(x == z);
1131}
1132
1133test "@trunc f80" {
11341186 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1135 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1136 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1137 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
1138 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1139
1140 if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) {
1141 // https://github.com/ziglang/zig/issues/12602
1142 return error.SkipZigTest;
1143 }
1144
1145 try testTruncLegacy(f80, 12.0);
1146 try comptime testTruncLegacy(f80, 12.0);
1147 comptime {
1148 const x: f80 = 12.0;
1149 const y = x + 0.8;
1150 const z = @trunc(y);
1151 try expect(x == z);
1152 }
1153}
1154
1155test "@trunc f128" {
1156 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1157 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1158 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1159 if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArmOrThumb()) return error.SkipZigTest;
1160 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1161
1162 try testTruncLegacy(f128, 12.0);
1163 try comptime testTruncLegacy(f128, 12.0);
1164}
1165
1166fn testTruncLegacy(comptime T: type, x: T) !void {
1167 {
1168 const y = x + 0.8;
1169 const z = @trunc(y);
1170 try expect(x == z);
1171 }
1172
1173 {
1174 const y = -x - 0.8;
1175 const z = @trunc(y);
1176 try expect(-x == z);
1177 }
1178}
1179
1180test "negation f16" {
1181 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1182 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
11831187 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
11841188 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1189 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
11851190 if (no_x86_64_hardware_f16_support) return error.SkipZigTest;
11861191
11871192 if (builtin.os.tag == .freebsd) {
......@@ -1189,100 +1194,85 @@ test "negation f16" {
11891194 return error.SkipZigTest;
11901195 }
11911196
1192 const S = struct {
1193 fn doTheTest() !void {
1194 var a: f16 = 1;
1195 a = -a;
1196 try expect(a == -1);
1197 a = -a;
1198 try expect(a == 1);
1199 }
1200 };
1201
1202 try S.doTheTest();
1203 try comptime S.doTheTest();
1197 try testNeg(f16);
1198 try comptime testNeg(f16);
12041199}
12051200
1206test "negation f32" {
1207 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1201test "neg f32/f64" {
12081202 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1209 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1210 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1211
1212 const S = struct {
1213 fn doTheTest() !void {
1214 var a: f32 = 1;
1215 a = -a;
1216 try expect(a == -1);
1217 a = -a;
1218 try expect(a == 1);
1219 }
1220 };
1221
1222 try S.doTheTest();
1223 try comptime S.doTheTest();
1224}
1225
1226test "negation f64" {
12271203 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1228 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
12291204 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
12301205 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1206 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
12311207
1232 const S = struct {
1233 fn doTheTest() !void {
1234 var a: f64 = 1;
1235 a = -a;
1236 try expect(a == -1);
1237 a = -a;
1238 try expect(a == 1);
1239 }
1240 };
1241
1242 try S.doTheTest();
1243 try comptime S.doTheTest();
1208 try testNeg(f32);
1209 try comptime testNeg(f32);
1210 try testNeg(f64);
1211 try comptime testNeg(f64);
12441212}
12451213
1246test "negation f80" {
1247 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1214test "neg f80/f128/c_longdouble" {
12481215 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1249 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1250 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1251 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1252
1253 const S = struct {
1254 fn doTheTest() !void {
1255 var a: f80 = 1;
1256 a = -a;
1257 try expect(a == -1);
1258 a = -a;
1259 try expect(a == 1);
1260 }
1261 };
1262
1263 try S.doTheTest();
1264 try comptime S.doTheTest();
1265}
1266
1267test "negation f128" {
12681216 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1269 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
12701217 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
12711218 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1219 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
12721220 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
12731221
1274 const S = struct {
1275 fn doTheTest() !void {
1276 var a: f128 = 1;
1277 a = -a;
1278 try expect(a == -1);
1279 a = -a;
1280 try expect(a == 1);
1281 }
1282 };
1283
1284 try S.doTheTest();
1285 try comptime S.doTheTest();
1222 try testNeg(f80);
1223 try comptime testNeg(f80);
1224 try testNeg(f128);
1225 try comptime testNeg(f128);
1226 try testNeg(c_longdouble);
1227 try comptime testNeg(c_longdouble);
1228}
1229
1230fn testNeg(comptime T: type) !void {
1231 var two_point_five: T = 2.5;
1232 try expect(-two_point_five == -2.5);
1233 var neg_two_point_five: T = -2.5;
1234 try expect(-neg_two_point_five == 2.5);
1235
1236 var twelve: T = 12.0;
1237 try expect(-twelve == -12.0);
1238 var neg_fourteen: T = -14.0;
1239 try expect(-neg_fourteen == 14.0);
1240
1241 // normals
1242 var one: T = 1.0;
1243 try expect(-one == -1.0);
1244 var neg_one: T = -1.0;
1245 try expect(-neg_one == 1.0);
1246 var min: T = math.floatMin(T);
1247 try expect(-min == -math.floatMin(T));
1248 var neg_min: T = -math.floatMin(T);
1249 try expect(-neg_min == math.floatMin(T));
1250 var max: T = math.floatMax(T);
1251 try expect(-max == -math.floatMax(T));
1252 var neg_max: T = -math.floatMax(T);
1253 try expect(-neg_max == math.floatMax(T));
1254
1255 // subnormals
1256 var zero: T = 0.0;
1257 try expect(-zero == -0.0);
1258 var neg_zero: T = -0.0;
1259 try expect(-neg_zero == 0.0);
1260 var true_min: T = math.floatTrueMin(T);
1261 try expect(-true_min == -math.floatTrueMin(T));
1262 var neg_true_min: T = -math.floatTrueMin(T);
1263 try expect(-neg_true_min == math.floatTrueMin(T));
1264
1265 // non-finite numbers
1266 var inf: T = math.inf(T);
1267 try expect(math.isNegativeInf(-inf));
1268 var neg_inf: T = -math.inf(T);
1269 try expect(math.isPositiveInf(-neg_inf));
1270 var nan: T = math.nan(T);
1271 try expect(math.isNan(-nan));
1272 try expect(math.signbit(-nan));
1273 var neg_nan: T = -math.nan(T);
1274 try expect(math.isNan(-neg_nan));
1275 try expect(!math.signbit(-neg_nan));
12861276}
12871277
12881278test "eval @setFloatMode at compile-time" {
......@@ -1337,99 +1327,3 @@ test "comptime fixed-width float non-zero divided by zero produces signed Inf" {
13371327test "comptime_float zero divided by zero produces zero" {
13381328 try expect((0.0 / 0.0) == 0.0);
13391329}
1340
1341test "nan negation f16" {
1342 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1343 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1344 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1345 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1346
1347 const nan_comptime = comptime math.nan(f16);
1348 const neg_nan_comptime = -nan_comptime;
1349
1350 var nan_runtime = math.nan(f16);
1351 const neg_nan_runtime = -nan_runtime;
1352
1353 try expect(!math.signbit(nan_runtime));
1354 try expect(math.signbit(neg_nan_runtime));
1355
1356 try expect(!math.signbit(nan_comptime));
1357 try expect(math.signbit(neg_nan_comptime));
1358}
1359
1360test "nan negation f32" {
1361 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1362 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1363 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1364 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1365
1366 const nan_comptime = comptime math.nan(f32);
1367 const neg_nan_comptime = -nan_comptime;
1368
1369 var nan_runtime = math.nan(f32);
1370 const neg_nan_runtime = -nan_runtime;
1371
1372 try expect(!math.signbit(nan_runtime));
1373 try expect(math.signbit(neg_nan_runtime));
1374
1375 try expect(!math.signbit(nan_comptime));
1376 try expect(math.signbit(neg_nan_comptime));
1377}
1378
1379test "nan negation f64" {
1380 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1381 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1382 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1383 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1384
1385 const nan_comptime = comptime math.nan(f64);
1386 const neg_nan_comptime = -nan_comptime;
1387
1388 var nan_runtime = math.nan(f64);
1389 const neg_nan_runtime = -nan_runtime;
1390
1391 try expect(!math.signbit(nan_runtime));
1392 try expect(math.signbit(neg_nan_runtime));
1393
1394 try expect(!math.signbit(nan_comptime));
1395 try expect(math.signbit(neg_nan_comptime));
1396}
1397
1398test "nan negation f128" {
1399 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1400 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1401 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1402 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1403
1404 const nan_comptime = comptime math.nan(f128);
1405 const neg_nan_comptime = -nan_comptime;
1406
1407 var nan_runtime = math.nan(f128);
1408 const neg_nan_runtime = -nan_runtime;
1409
1410 try expect(!math.signbit(nan_runtime));
1411 try expect(math.signbit(neg_nan_runtime));
1412
1413 try expect(!math.signbit(nan_comptime));
1414 try expect(math.signbit(neg_nan_comptime));
1415}
1416
1417test "nan negation f80" {
1418 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1419 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1420 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
1421 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
1422 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
1423
1424 const nan_comptime = comptime math.nan(f80);
1425 const neg_nan_comptime = -nan_comptime;
1426
1427 var nan_runtime = math.nan(f80);
1428 const neg_nan_runtime = -nan_runtime;
1429
1430 try expect(!math.signbit(nan_runtime));
1431 try expect(math.signbit(neg_nan_runtime));
1432
1433 try expect(!math.signbit(nan_comptime));
1434 try expect(math.signbit(neg_nan_comptime));
1435}
test/behavior/vector.zig+2-8
......@@ -8,7 +8,6 @@ const expectEqual = std.testing.expectEqual;
88
99test "implicit cast vector to array - bool" {
1010 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
11 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
1211 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
1312 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
1413 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
......@@ -214,13 +213,12 @@ test "array vector coercion - odd sizes" {
214213}
215214
216215test "array to vector with element type coercion" {
217 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
218 if (builtin.zig_backend == .stage2_x86_64 and
219 !comptime std.Target.x86.featureSetHas(builtin.cpu.features, .f16c)) return error.SkipZigTest; // TODO
220216 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
221217 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
222218 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
223219 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
220 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
221 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
224222
225223 const S = struct {
226224 fn doTheTest() !void {
......@@ -236,7 +234,6 @@ test "array to vector with element type coercion" {
236234
237235test "peer type resolution with coercible element types" {
238236 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
239 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
240237 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
241238 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
242239 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
......@@ -1440,7 +1437,6 @@ test "vector pointer is indexable" {
14401437 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
14411438 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
14421439 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
1443 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
14441440 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
14451441 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO
14461442
......@@ -1466,7 +1462,6 @@ test "boolean vector with 2 or more booleans" {
14661462 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
14671463 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
14681464 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
1469 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
14701465 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
14711466
14721467 // TODO: try removing this after <https://github.com/ziglang/zig/issues/13782>:
......@@ -1483,7 +1478,6 @@ test "bitcast to vector with different child type" {
14831478 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
14841479 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
14851480 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
1486 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
14871481 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
14881482 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO
14891483