From 3c69810fe6660fa3115d345bb60b3f811ac7c8c0 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Tue, 10 May 2022 21:30:39 +0200 Subject: [PATCH] x64: fix binary not implementation --- src/arch/x86_64/CodeGen.zig | 3 ++- test/behavior/math.zig | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index 087f7e3d62..be053f310c 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -1154,7 +1154,8 @@ fn airNot(self: *Self, inst: Air.Inst.Index) !void { }; defer if (dst_mcv_lock) |lock| self.register_manager.unlockReg(lock); - try self.genBinOpMir(.xor, operand_ty, dst_mcv, .{ .immediate = 1 }); + const mask = ~@as(u64, 0); + try self.genBinOpMir(.xor, operand_ty, dst_mcv, .{ .immediate = mask }); break :result dst_mcv; }; diff --git a/test/behavior/math.zig b/test/behavior/math.zig index 85b62e0275..53a3f61d14 100644 --- a/test/behavior/math.zig +++ b/test/behavior/math.zig @@ -362,7 +362,6 @@ fn comptimeAdd(comptime a: comptime_int, comptime b: comptime_int) comptime_int test "binary not" { if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO try expect(comptime x: { break :x ~@as(u16, 0b1010101010101010) == 0b0101010101010101;