| ... | @@ -807,6 +807,23 @@ test "vector reduce operation" { | ... | @@ -807,6 +807,23 @@ test "vector reduce operation" { |
| 807 | comptime try S.doTheTest(); | 807 | comptime try S.doTheTest(); |
| 808 | } | 808 | } |
| 809 | | 809 | |
| | 810 | test "vector @reduce comptime" { |
| | 811 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; |
| | 812 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| | 813 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| | 814 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| | 815 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| | 816 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| | 817 | |
| | 818 | const value = @Vector(4, i32){ 1, -1, 1, -1 }; |
| | 819 | const result = value > @splat(4, @as(i32, 0)); |
| | 820 | // result is { true, false, true, false }; |
| | 821 | comptime try expect(@TypeOf(result) == @Vector(4, bool)); |
| | 822 | const is_all_true = @reduce(.And, result); |
| | 823 | comptime try expect(@TypeOf(is_all_true) == bool); |
| | 824 | try expect(is_all_true == false); |
| | 825 | } |
| | 826 | |
| 810 | test "mask parameter of @shuffle is comptime scope" { | 827 | test "mask parameter of @shuffle is comptime scope" { |
| 811 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 828 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 812 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 829 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |