diff --git a/test/stage1/behavior/vector.zig b/test/stage1/behavior/vector.zig index 5e3e446109..b0d2871454 100644 --- a/test/stage1/behavior/vector.zig +++ b/test/stage1/behavior/vector.zig @@ -29,3 +29,17 @@ test "vector float operators" { S.doTheTest(); comptime S.doTheTest(); } + +test "vector bit operators" { + const S = struct { + fn doTheTest() void { + const v: @Vector(4, u8) = [4]u8{ 0b10101010, 0b10101010, 0b10101010, 0b10101010 }; + const x: @Vector(4, u8) = [4]u8{ 0b11110000, 0b00001111, 0b10101010, 0b01010101 }; + expect(mem.eql(u8, ([4]u8)(v ^ x), [4]u8{ 0b01011010, 0b10100101, 0b00000000, 0b11111111 })); + expect(mem.eql(u8, ([4]u8)(v | x), [4]u8{ 0b11111010, 0b10101111, 0b10101010, 0b11111111 })); + expect(mem.eql(u8, ([4]u8)(v & x), [4]u8{ 0b10100000, 0b00001010, 0b10101010, 0b00000000 })); + } + }; + S.doTheTest(); + comptime S.doTheTest(); +}