aboutsummaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2023-03-25 11:00:42 -0400
committerJacob Young <jacobly0@users.noreply.github.com>2023-03-25 16:23:55 -0400
commit6d9bdc8733419ebfc9527d114b637c57d3fd8a42 (patch)
tree7a2ed1ad926b0507612563675adfed555a8471fd /src/arch
parenta2f6e068b0082692f2c5475c1e31290b9c016010 (diff)
downloadzig-6d9bdc8733419ebfc9527d114b637c57d3fd8a42.tar.gz
zig-6d9bdc8733419ebfc9527d114b637c57d3fd8a42.zip
x86_64: fix cmpxchg
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/x86_64/CodeGen.zig2
-rw-r--r--src/arch/x86_64/encodings.zig4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig
index 3c64f15ef1..c7326ef3b0 100644
--- a/src/arch/x86_64/CodeGen.zig
+++ b/src/arch/x86_64/CodeGen.zig
@@ -7242,7 +7242,7 @@ fn airCmpxchg(self: *Self, inst: Air.Inst.Index) !void {
try self.spillEflagsIfOccupied();
_ = try self.addInst(.{ .tag = .cmpxchg, .ops = .lock_mr_sib, .data = .{ .rx = .{
- .r = new_reg,
+ .r = registerAlias(new_reg, val_abi_size),
.payload = try self.addExtra(Mir.MemorySib.encode(ptr_mem)),
} } });
diff --git a/src/arch/x86_64/encodings.zig b/src/arch/x86_64/encodings.zig
index d0ded0136b..9683ef991a 100644
--- a/src/arch/x86_64/encodings.zig
+++ b/src/arch/x86_64/encodings.zig
@@ -257,8 +257,8 @@ pub const table = &[_]Entry{
.{ .cmpxchg, .mr, .rm8, .r8, .none, .none, &.{ 0x0f, 0xb0 }, 0, .none },
.{ .cmpxchg, .mr, .rm8, .r8, .none, .none, &.{ 0x0f, 0xb0 }, 0, .rex },
- .{ .cmpxchg, .mr, .rm16, .r16, .none, .none, &.{ 0x0f, 0xb1 }, 0, .rex },
- .{ .cmpxchg, .mr, .rm32, .r32, .none, .none, &.{ 0x0f, 0xb1 }, 0, .rex },
+ .{ .cmpxchg, .mr, .rm16, .r16, .none, .none, &.{ 0x0f, 0xb1 }, 0, .none },
+ .{ .cmpxchg, .mr, .rm32, .r32, .none, .none, &.{ 0x0f, 0xb1 }, 0, .none },
.{ .cmpxchg, .mr, .rm64, .r64, .none, .none, &.{ 0x0f, 0xb1 }, 0, .long },
.{ .cmpxchg8b , .m, .m64, .none, .none, .none, &.{ 0x0f, 0xc7 }, 1, .none },