| ... | @@ -1,3 +1,4 @@ | ... | @@ -1,3 +1,4 @@ |
| | 1 | const builtin = @import("builtin"); |
| 1 | const std = @import("std.zig"); | 2 | const std = @import("std.zig"); |
| 2 | const assert = std.debug.assert; | 3 | const assert = std.debug.assert; |
| 3 | const mem = std.mem; | 4 | const mem = std.mem; |
| ... | @@ -506,6 +507,12 @@ pub fn shl(comptime T: type, a: T, shift_amt: anytype) T { | ... | @@ -506,6 +507,12 @@ pub fn shl(comptime T: type, a: T, shift_amt: anytype) T { |
| 506 | } | 507 | } |
| 507 | | 508 | |
| 508 | test "shl" { | 509 | test "shl" { |
| | 510 | if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and |
| | 511 | builtin.cpu.arch == .aarch64) |
| | 512 | { |
| | 513 | // https://github.com/ziglang/zig/issues/12012 |
| | 514 | return error.SkipZigTest; |
| | 515 | } |
| 509 | try testing.expect(shl(u8, 0b11111111, @as(usize, 3)) == 0b11111000); | 516 | try testing.expect(shl(u8, 0b11111111, @as(usize, 3)) == 0b11111000); |
| 510 | try testing.expect(shl(u8, 0b11111111, @as(usize, 8)) == 0); | 517 | try testing.expect(shl(u8, 0b11111111, @as(usize, 8)) == 0); |
| 511 | try testing.expect(shl(u8, 0b11111111, @as(usize, 9)) == 0); | 518 | try testing.expect(shl(u8, 0b11111111, @as(usize, 9)) == 0); |
| ... | @@ -546,6 +553,12 @@ pub fn shr(comptime T: type, a: T, shift_amt: anytype) T { | ... | @@ -546,6 +553,12 @@ pub fn shr(comptime T: type, a: T, shift_amt: anytype) T { |
| 546 | } | 553 | } |
| 547 | | 554 | |
| 548 | test "shr" { | 555 | test "shr" { |
| | 556 | if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and |
| | 557 | builtin.cpu.arch == .aarch64) |
| | 558 | { |
| | 559 | // https://github.com/ziglang/zig/issues/12012 |
| | 560 | return error.SkipZigTest; |
| | 561 | } |
| 549 | try testing.expect(shr(u8, 0b11111111, @as(usize, 3)) == 0b00011111); | 562 | try testing.expect(shr(u8, 0b11111111, @as(usize, 3)) == 0b00011111); |
| 550 | try testing.expect(shr(u8, 0b11111111, @as(usize, 8)) == 0); | 563 | try testing.expect(shr(u8, 0b11111111, @as(usize, 8)) == 0); |
| 551 | try testing.expect(shr(u8, 0b11111111, @as(usize, 9)) == 0); | 564 | try testing.expect(shr(u8, 0b11111111, @as(usize, 9)) == 0); |
| ... | @@ -578,6 +591,12 @@ pub fn rotr(comptime T: type, x: T, r: anytype) T { | ... | @@ -578,6 +591,12 @@ pub fn rotr(comptime T: type, x: T, r: anytype) T { |
| 578 | } | 591 | } |
| 579 | | 592 | |
| 580 | test "rotr" { | 593 | test "rotr" { |
| | 594 | if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and |
| | 595 | builtin.cpu.arch == .aarch64) |
| | 596 | { |
| | 597 | // https://github.com/ziglang/zig/issues/12012 |
| | 598 | return error.SkipZigTest; |
| | 599 | } |
| 581 | try testing.expect(rotr(u8, 0b00000001, @as(usize, 0)) == 0b00000001); | 600 | try testing.expect(rotr(u8, 0b00000001, @as(usize, 0)) == 0b00000001); |
| 582 | try testing.expect(rotr(u8, 0b00000001, @as(usize, 9)) == 0b10000000); | 601 | try testing.expect(rotr(u8, 0b00000001, @as(usize, 9)) == 0b10000000); |
| 583 | try testing.expect(rotr(u8, 0b00000001, @as(usize, 8)) == 0b00000001); | 602 | try testing.expect(rotr(u8, 0b00000001, @as(usize, 8)) == 0b00000001); |
| ... | @@ -606,6 +625,12 @@ pub fn rotl(comptime T: type, x: T, r: anytype) T { | ... | @@ -606,6 +625,12 @@ pub fn rotl(comptime T: type, x: T, r: anytype) T { |
| 606 | } | 625 | } |
| 607 | | 626 | |
| 608 | test "rotl" { | 627 | test "rotl" { |
| | 628 | if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and |
| | 629 | builtin.cpu.arch == .aarch64) |
| | 630 | { |
| | 631 | // https://github.com/ziglang/zig/issues/12012 |
| | 632 | return error.SkipZigTest; |
| | 633 | } |
| 609 | try testing.expect(rotl(u8, 0b00000001, @as(usize, 0)) == 0b00000001); | 634 | try testing.expect(rotl(u8, 0b00000001, @as(usize, 0)) == 0b00000001); |
| 610 | try testing.expect(rotl(u8, 0b00000001, @as(usize, 9)) == 0b00000010); | 635 | try testing.expect(rotl(u8, 0b00000001, @as(usize, 9)) == 0b00000010); |
| 611 | try testing.expect(rotl(u8, 0b00000001, @as(usize, 8)) == 0b00000001); | 636 | try testing.expect(rotl(u8, 0b00000001, @as(usize, 8)) == 0b00000001); |
| ... | @@ -1622,6 +1647,12 @@ fn testSign() !void { | ... | @@ -1622,6 +1647,12 @@ fn testSign() !void { |
| 1622 | } | 1647 | } |
| 1623 | | 1648 | |
| 1624 | test "sign" { | 1649 | test "sign" { |
| | 1650 | if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and |
| | 1651 | builtin.cpu.arch == .aarch64) |
| | 1652 | { |
| | 1653 | // https://github.com/ziglang/zig/issues/12012 |
| | 1654 | return error.SkipZigTest; |
| | 1655 | } |
| 1625 | try testSign(); | 1656 | try testSign(); |
| 1626 | comptime try testSign(); | 1657 | comptime try testSign(); |
| 1627 | } | 1658 | } |