| ... | ... | @@ -7,16 +7,46 @@ const expect = std.testing.expect; |
| 7 | 7 | const expectEqual = std.testing.expectEqual; |
| 8 | 8 | |
| 9 | 9 | test "implicit cast vector to array - bool" { |
| 10 | | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 11 | | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 12 | | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 13 | | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 10 | if (builtin.cpu.arch == .aarch64_be and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; |
| 11 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 12 | |
| 13 | const S = struct { |
| 14 | fn doTheTest() !void { |
| 15 | { |
| 16 | var v: @Vector(4, bool) = undefined; |
| 17 | v = .{ true, false, true, false }; |
| 18 | const a: [4]bool = v; |
| 19 | try expect(mem.eql(bool, &a, &.{ true, false, true, false })); |
| 20 | } |
| 21 | { |
| 22 | var v: @Vector(25, bool) = undefined; |
| 23 | v = .{ false, false, false, false, true, true, false, false, false, true, false, true, false, false, true, false, false, true, false, false, true, true, true, false, false }; |
| 24 | const a: [25]bool = v; |
| 25 | try expect(mem.eql(bool, &a, &.{ false, false, false, false, true, true, false, false, false, true, false, true, false, false, true, false, false, true, false, false, true, true, true, false, false })); |
| 26 | } |
| 27 | } |
| 28 | }; |
| 29 | try S.doTheTest(); |
| 30 | try comptime S.doTheTest(); |
| 31 | } |
| 32 | |
| 33 | test "implicit cast array to vector - bool" { |
| 34 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 14 | 35 | |
| 15 | 36 | const S = struct { |
| 16 | 37 | fn doTheTest() !void { |
| 17 | | const a: @Vector(4, bool) = [_]bool{ true, false, true, false }; |
| 18 | | const result_array: [4]bool = a; |
| 19 | | try expect(mem.eql(bool, &result_array, &[4]bool{ true, false, true, false })); |
| 38 | { |
| 39 | var a: [4]bool = undefined; |
| 40 | a = .{ true, false, false, true }; |
| 41 | const v: @Vector(4, bool) = a; |
| 42 | try expect(mem.eql(bool, &@as([4]bool, v), &.{ true, false, false, true })); |
| 43 | } |
| 44 | { |
| 45 | var a: [25]bool = undefined; |
| 46 | a = .{ true, false, false, true, false, false, false, false, false, true, true, true, true, false, false, false, false, true, false, false, false, true, true, true, false }; |
| 47 | const v: @Vector(25, bool) = a; |
| 48 | try expect(mem.eql(bool, &@as([25]bool, v), &.{ true, false, false, true, false, false, false, false, false, true, true, true, true, false, false, false, false, true, false, false, false, true, true, true, false })); |
| 49 | } |
| 20 | 50 | } |
| 21 | 51 | }; |
| 22 | 52 | try S.doTheTest(); |
| ... | ... | @@ -606,7 +636,7 @@ test "vector bitwise not operator" { |
| 606 | 636 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 607 | 637 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 608 | 638 | |
| 609 | | if (builtin.cpu.arch == .aarch64_be) { |
| 639 | if (builtin.cpu.arch == .aarch64_be and builtin.zig_backend == .stage2_llvm) { |
| 610 | 640 | // https://github.com/ziglang/zig/issues/24061 |
| 611 | 641 | return error.SkipZigTest; |
| 612 | 642 | } |
| ... | ... | @@ -645,7 +675,7 @@ test "vector boolean not operator" { |
| 645 | 675 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 646 | 676 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 647 | 677 | |
| 648 | | if (builtin.cpu.arch == .aarch64_be) { |
| 678 | if (builtin.cpu.arch == .aarch64_be and builtin.zig_backend == .stage2_llvm) { |
| 649 | 679 | // https://github.com/ziglang/zig/issues/24061 |
| 650 | 680 | return error.SkipZigTest; |
| 651 | 681 | } |