From c5b70e615f9f7a09a54426d9b2623920d2659b65 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Thu, 6 Feb 2014 22:18:15 -0800 Subject: [PATCH] Fixing div. --- src/alloy/backend/x64/lowering/lowering_sequences.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/alloy/backend/x64/lowering/lowering_sequences.cc b/src/alloy/backend/x64/lowering/lowering_sequences.cc index 38007aed5..754fd0d07 100644 --- a/src/alloy/backend/x64/lowering/lowering_sequences.cc +++ b/src/alloy/backend/x64/lowering/lowering_sequences.cc @@ -2199,7 +2199,9 @@ table->AddSequence(OPCODE_DIV, [](X64Emitter& e, Instr*& i) { // RAX = value, RDX = clobbered // TODO(benvanik): make the register allocator put dest_src in RAX? auto Nax = LIKE_REG(e.rax, dest_src); + auto Ndx = LIKE_REG(e.rdx, dest_src); e.mov(Nax, dest_src); + e.xor(Ndx, Ndx); if (i.flags & ARITHMETIC_UNSIGNED) { e.div(src); } else {