| ... | @@ -7,16 +7,50 @@ const expect = std.testing.expect; | ... | @@ -7,16 +7,50 @@ const expect = std.testing.expect; |
| 7 | const expectEqual = std.testing.expectEqual; | 7 | const expectEqual = std.testing.expectEqual; |
| 8 | | 8 | |
| 9 | test "implicit cast vector to array - bool" { | 9 | test "implicit cast vector to array - bool" { |
| 10 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 10 | if (builtin.cpu.arch == .aarch64_be and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; |
| 11 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 11 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 12 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 12 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| | 13 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; |
| | 14 | |
| | 15 | const S = struct { |
| | 16 | fn doTheTest() !void { |
| | 17 | { |
| | 18 | var v: @Vector(4, bool) = undefined; |
| | 19 | v = .{ true, false, true, false }; |
| | 20 | const a: [4]bool = v; |
| | 21 | try expect(mem.eql(bool, &a, &.{ true, false, true, false })); |
| | 22 | } |
| | 23 | { |
| | 24 | var v: @Vector(25, bool) = undefined; |
| | 25 | 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 }; |
| | 26 | const a: [25]bool = v; |
| | 27 | 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 })); |
| | 28 | } |
| | 29 | } |
| | 30 | }; |
| | 31 | try S.doTheTest(); |
| | 32 | try comptime S.doTheTest(); |
| | 33 | } |
| | 34 | |
| | 35 | test "implicit cast array to vector - bool" { |
| | 36 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 13 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 37 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| | 38 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; |
| 14 | | 39 | |
| 15 | const S = struct { | 40 | const S = struct { |
| 16 | fn doTheTest() !void { | 41 | fn doTheTest() !void { |
| 17 | const a: @Vector(4, bool) = [_]bool{ true, false, true, false }; | 42 | { |
| 18 | const result_array: [4]bool = a; | 43 | var a: [4]bool = undefined; |
| 19 | try expect(mem.eql(bool, &result_array, &[4]bool{ true, false, true, false })); | 44 | a = .{ true, false, false, true }; |
| | 45 | const v: @Vector(4, bool) = a; |
| | 46 | try expect(mem.eql(bool, &@as([4]bool, v), &.{ true, false, false, true })); |
| | 47 | } |
| | 48 | { |
| | 49 | var a: [25]bool = undefined; |
| | 50 | 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 }; |
| | 51 | const v: @Vector(25, bool) = a; |
| | 52 | 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 })); |
| | 53 | } |
| 20 | } | 54 | } |
| 21 | }; | 55 | }; |
| 22 | try S.doTheTest(); | 56 | try S.doTheTest(); |