| author | |
| committer | |
| log | 3d1fb4fac8d4ce47d6e306b33def16ab49445190 |
| tree | 8487e3a105cb5d3fba7d1ab198aa64d1b3b80af9 |
| parent | a794287573a84f04f675efeb3278ebc00755a57b |
3 files changed, 51 insertions(+), 1 deletions(-)
test/behavior/bitcast.zig+39| ... | @@ -552,3 +552,42 @@ test "@bitCast of extern struct containing pointer" { | ... | @@ -552,3 +552,42 @@ test "@bitCast of extern struct containing pointer" { |
| 552 | try S.doTheTest(); | 552 | try S.doTheTest(); |
| 553 | try comptime S.doTheTest(); | 553 | try comptime S.doTheTest(); |
| 554 | } | 554 | } |
| 555 | |||
| 556 | test "@bitCast of extern struct to float" { | ||
| 557 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | ||
| 558 | |||
| 559 | const S = struct { | ||
| 560 | const S = extern struct { | ||
| 561 | x: u16, | ||
| 562 | y: u16, | ||
| 563 | }; | ||
| 564 | fn doTheTest() !void { | ||
| 565 | var s: S = .{ .x = 0, .y = 0 }; | ||
| 566 | _ = &s; | ||
| 567 | const a: f32 = @bitCast(s); | ||
| 568 | try expect(a == 0); | ||
| 569 | } | ||
| 570 | }; | ||
| 571 | |||
| 572 | try S.doTheTest(); | ||
| 573 | try comptime S.doTheTest(); | ||
| 574 | } | ||
| 575 | |||
| 576 | test "@bitCast of float to extern struct" { | ||
| 577 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | ||
| 578 | |||
| 579 | const S = struct { | ||
| 580 | const S = extern struct { | ||
| 581 | x: u32, | ||
| 582 | }; | ||
| 583 | fn doTheTest() !void { | ||
| 584 | var a: f32 = -0.0; | ||
| 585 | _ = &a; | ||
| 586 | const s: S = @bitCast(a); | ||
| 587 | try expect(s.x == 0x80000000); | ||
| 588 | } | ||
| 589 | }; | ||
| 590 | |||
| 591 | try S.doTheTest(); | ||
| 592 | try comptime S.doTheTest(); | ||
| 593 | } |
test/behavior/floatop.zig+11| ... | @@ -1539,6 +1539,17 @@ fn testNeg(comptime T: type) !void { | ... | @@ -1539,6 +1539,17 @@ fn testNeg(comptime T: type) !void { |
| 1539 | }; | 1539 | }; |
| 1540 | } | 1540 | } |
| 1541 | 1541 | ||
| 1542 | test "negate f80" { | ||
| 1543 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | ||
| 1544 | |||
| 1545 | var f: f80 = 0.0; | ||
| 1546 | const a: u80 = @bitCast(f); | ||
| 1547 | try expect(a == 0); | ||
| 1548 | f = -f; | ||
| 1549 | const b: u80 = @bitCast(f); | ||
| 1550 | try expect(b == 0x8000_00000000_00000000); | ||
| 1551 | } | ||
| 1552 | |||
| 1542 | test "eval @setFloatMode at compile-time" { | 1553 | test "eval @setFloatMode at compile-time" { |
| 1543 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 1554 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1544 | 1555 |
test/tests.zig+1-1| ... | @@ -1496,7 +1496,7 @@ const module_test_targets = blk: { | ... | @@ -1496,7 +1496,7 @@ const module_test_targets = blk: { |
| 1496 | .os_tag = .wasi, | 1496 | .os_tag = .wasi, |
| 1497 | .abi = .none, | 1497 | .abi = .none, |
| 1498 | }, | 1498 | }, |
| 1499 | .skip_modules = &.{"compiler-rt"}, | 1499 | .skip_modules = &.{ "compiler-rt", "std" }, |
| 1500 | .use_llvm = false, | 1500 | .use_llvm = false, |
| 1501 | .use_lld = false, | 1501 | .use_lld = false, |
| 1502 | }, | 1502 | }, |