x64: Migrate {s,u}{div,rem} to ISLE (#6008)

* x64: Add precise-output tests for div traps

This adds a suite of `*.clif` files which are intended to test the
`avoid_div_traps=true` compilation of the `{s,u}{div,rem}` instructions.

* x64: Remove conditional regalloc in `Div` instruction

Move the 8-bit `Div` logic into a dedicated `Div8` instruction to avoid
having conditionally-used registers with respect to regalloc.

* x64: Migrate non-trapping, `udiv`/`urem` to ISLE

* x64: Port checked `udiv` to ISLE

* x64: Migrate urem entirely to ISLE

* x64: Use `test` instead of `cmp` to compare-to-zero

* x64: Port `sdiv` lowering to ISLE

* x64: Port `srem` lowering to ISLE

* Tidy up regalloc behavior and fix tests

* Update docs and winch

* Review comments

* Reword again

* More refactoring test fixes

* More test fixes
This commit is contained in:
Alex Crichton
2023-03-13 20:44:06 -05:00
committed by GitHub
parent 188f712025
commit 5c1b468648
52 changed files with 2178 additions and 835 deletions

View File

@@ -5,10 +5,11 @@ use crate::{
masm::{DivKind, OperandSize, RemKind},
};
use cranelift_codegen::{
ir::TrapCode,
isa::x64::{
args::{
self, AluRmiROpcode, Amode, DivOrRemKind, ExtMode, FromWritableReg, Gpr, GprMem,
GprMemImm, RegMem, RegMemImm, SyntheticAmode, WritableGpr,
self, AluRmiROpcode, Amode, CmpOpcode, DivSignedness, ExtMode, FromWritableReg, Gpr,
GprMem, GprMemImm, RegMem, RegMemImm, SyntheticAmode, WritableGpr, CC,
},
settings as x64_settings, EmitInfo, EmitState, Inst,
},
@@ -64,20 +65,11 @@ impl From<OperandSize> for args::OperandSize {
}
}
impl From<DivKind> for DivOrRemKind {
fn from(kind: DivKind) -> Self {
impl From<DivKind> for DivSignedness {
fn from(kind: DivKind) -> DivSignedness {
match kind {
DivKind::Signed => DivOrRemKind::SignedDiv,
DivKind::Unsigned => DivOrRemKind::UnsignedDiv,
}
}
}
impl From<RemKind> for DivOrRemKind {
fn from(kind: RemKind) -> Self {
match kind {
RemKind::Signed => DivOrRemKind::SignedRem,
RemKind::Unsigned => DivOrRemKind::UnsignedRem,
DivKind::Signed => DivSignedness::Signed,
DivKind::Unsigned => DivSignedness::Unsigned,
}
}
}
@@ -290,21 +282,61 @@ impl Assembler {
/// caller has correctly allocated the dividend as `(rdx:rax)` and
/// accounted for the quotient to be stored in `rax`.
pub fn div(&mut self, divisor: Reg, dst: (Reg, Reg), kind: DivKind, size: OperandSize) {
let tmp = if size == OperandSize::S64 && kind == DivKind::Signed {
Some(regs::scratch())
} else {
None
};
match kind {
// Signed division goes through a pseudo-instruction to validate
// the divisor followed by a sign extension to initialize `rdx`.
DivKind::Signed => {
if size == OperandSize::S64 {
self.emit(Inst::ValidateSdivDivisor64 {
dividend: dst.0.into(),
divisor: divisor.into(),
tmp: regs::scratch().into(),
});
} else {
self.emit(Inst::ValidateSdivDivisor {
dividend: dst.0.into(),
divisor: divisor.into(),
size: size.into(),
});
}
self.emit(Inst::SignExtendData {
size: size.into(),
src: dst.0.into(),
dst: dst.1.into(),
});
}
self.emit(Inst::CheckedDivOrRemSeq {
kind: kind.into(),
// Unsigned division only needs to check for 0 and then the `rdx`
// divisor_hi is initialized with zero through an xor-against-itself
// op.
DivKind::Unsigned => {
self.emit(Inst::CmpRmiR {
size: size.into(),
src: GprMemImm::new(RegMemImm::imm(0)).unwrap(),
dst: divisor.into(),
opcode: CmpOpcode::Cmp,
});
self.emit(Inst::TrapIf {
cc: CC::Z,
trap_code: TrapCode::IntegerDivisionByZero,
});
self.emit(Inst::AluRmiR {
size: size.into(),
op: AluRmiROpcode::Xor,
src1: dst.1.into(),
src2: dst.1.into(),
dst: dst.1.into(),
});
}
}
self.emit(Inst::Div {
sign: kind.into(),
size: size.into(),
divisor: divisor.into(),
divisor: GprMem::new(RegMem::reg(divisor.into())).unwrap(),
dividend_lo: dst.0.into(),
dividend_hi: dst.1.into(),
dst_quotient: dst.0.into(),
dst_remainder: dst.1.into(),
tmp: tmp.map(|reg| reg.into()),
});
}
@@ -316,16 +348,58 @@ impl Assembler {
/// caller has correctly allocated the dividend as `(rdx:rax)` and
/// accounted for the remainder to be stored in `rdx`.
pub fn rem(&mut self, divisor: Reg, dst: (Reg, Reg), kind: RemKind, size: OperandSize) {
self.emit(Inst::CheckedDivOrRemSeq {
kind: kind.into(),
// First check for zero and explicitly trap.
self.emit(Inst::CmpRmiR {
size: size.into(),
divisor: divisor.into(),
dividend_lo: dst.0.into(),
dividend_hi: dst.1.into(),
dst_quotient: dst.0.into(),
dst_remainder: dst.1.into(),
tmp: None,
src: GprMemImm::new(RegMemImm::imm(0)).unwrap(),
dst: divisor.into(),
opcode: CmpOpcode::Cmp,
});
self.emit(Inst::TrapIf {
cc: CC::Z,
trap_code: TrapCode::IntegerDivisionByZero,
});
match kind {
// Signed remainder goes through a pseudo-instruction which has
// some internal branching. The `dividend_hi`, or `rdx`, is
// initialized here with a `SignExtendData` instruction.
RemKind::Signed => {
self.emit(Inst::SignExtendData {
size: size.into(),
src: dst.0.into(),
dst: dst.1.into(),
});
self.emit(Inst::CheckedSRemSeq {
size: size.into(),
divisor: divisor.into(),
dividend_lo: dst.0.into(),
dividend_hi: dst.1.into(),
dst_quotient: dst.0.into(),
dst_remainder: dst.1.into(),
});
}
// Unsigned remainder initializes `dividend_hi` with zero and
// then executes a normal `div` instruction.
RemKind::Unsigned => {
self.emit(Inst::AluRmiR {
size: size.into(),
op: AluRmiROpcode::Xor,
src1: dst.1.into(),
src2: dst.1.into(),
dst: dst.1.into(),
});
self.emit(Inst::Div {
sign: DivSignedness::Unsigned,
size: size.into(),
divisor: GprMem::new(RegMem::reg(divisor.into())).unwrap(),
dividend_lo: dst.0.into(),
dividend_hi: dst.1.into(),
dst_quotient: dst.0.into(),
dst_remainder: dst.1.into(),
});
}
}
}
/// Multiply immediate and register.

View File

@@ -14,7 +14,7 @@
;; e: 83f900 cmp ecx, 0
;; 11: 0f8502000000 jne 0x19
;; 17: 0f0b ud2
;; 19: ba00000000 mov edx, 0
;; 1e: f7f1 div ecx
;; 20: 5d pop rbp
;; 21: c3 ret
;; 19: 31d2 xor edx, edx
;; 1b: f7f1 div ecx
;; 1d: 5d pop rbp
;; 1e: c3 ret

View File

@@ -14,7 +14,7 @@
;; e: 83f900 cmp ecx, 0
;; 11: 0f8502000000 jne 0x19
;; 17: 0f0b ud2
;; 19: ba00000000 mov edx, 0
;; 1e: f7f1 div ecx
;; 20: 5d pop rbp
;; 21: c3 ret
;; 19: 31d2 xor edx, edx
;; 1b: f7f1 div ecx
;; 1d: 5d pop rbp
;; 1e: c3 ret

View File

@@ -17,8 +17,8 @@
;; 16: 83f900 cmp ecx, 0
;; 19: 0f8502000000 jne 0x21
;; 1f: 0f0b ud2
;; 21: ba00000000 mov edx, 0
;; 26: f7f1 div ecx
;; 28: 4883c408 add rsp, 8
;; 2c: 5d pop rbp
;; 2d: c3 ret
;; 21: 31d2 xor edx, edx
;; 23: f7f1 div ecx
;; 25: 4883c408 add rsp, 8
;; 29: 5d pop rbp
;; 2a: c3 ret

View File

@@ -14,7 +14,7 @@
;; e: 83f900 cmp ecx, 0
;; 11: 0f8502000000 jne 0x19
;; 17: 0f0b ud2
;; 19: ba00000000 mov edx, 0
;; 1e: f7f1 div ecx
;; 20: 5d pop rbp
;; 21: c3 ret
;; 19: 31d2 xor edx, edx
;; 1b: f7f1 div ecx
;; 1d: 5d pop rbp
;; 1e: c3 ret

View File

@@ -14,7 +14,7 @@
;; e: 83f900 cmp ecx, 0
;; 11: 0f8502000000 jne 0x19
;; 17: 0f0b ud2
;; 19: ba00000000 mov edx, 0
;; 1e: f7f1 div ecx
;; 20: 5d pop rbp
;; 21: c3 ret
;; 19: 31d2 xor edx, edx
;; 1b: f7f1 div ecx
;; 1d: 5d pop rbp
;; 1e: c3 ret

View File

@@ -14,11 +14,11 @@
;; e: 83f900 cmp ecx, 0
;; 11: 0f8502000000 jne 0x19
;; 17: 0f0b ud2
;; 19: 83f9ff cmp ecx, -1
;; 1c: 0f850a000000 jne 0x2c
;; 22: b800000000 mov eax, 0
;; 27: e903000000 jmp 0x2f
;; 2c: 99 cdq
;; 19: 99 cdq
;; 1a: 83f9ff cmp ecx, -1
;; 1d: 0f850a000000 jne 0x2d
;; 23: ba00000000 mov edx, 0
;; 28: e902000000 jmp 0x2f
;; 2d: f7f9 idiv ecx
;; 2f: 4889d0 mov rax, rdx
;; 32: 5d pop rbp

View File

@@ -14,11 +14,11 @@
;; e: 83f900 cmp ecx, 0
;; 11: 0f8502000000 jne 0x19
;; 17: 0f0b ud2
;; 19: 83f9ff cmp ecx, -1
;; 1c: 0f850a000000 jne 0x2c
;; 22: b800000000 mov eax, 0
;; 27: e903000000 jmp 0x2f
;; 2c: 99 cdq
;; 19: 99 cdq
;; 1a: 83f9ff cmp ecx, -1
;; 1d: 0f850a000000 jne 0x2d
;; 23: ba00000000 mov edx, 0
;; 28: e902000000 jmp 0x2f
;; 2d: f7f9 idiv ecx
;; 2f: 4889d0 mov rax, rdx
;; 32: 5d pop rbp

View File

@@ -14,11 +14,11 @@
;; e: 83f900 cmp ecx, 0
;; 11: 0f8502000000 jne 0x19
;; 17: 0f0b ud2
;; 19: 83f9ff cmp ecx, -1
;; 1c: 0f850a000000 jne 0x2c
;; 22: b800000000 mov eax, 0
;; 27: e903000000 jmp 0x2f
;; 2c: 99 cdq
;; 19: 99 cdq
;; 1a: 83f9ff cmp ecx, -1
;; 1d: 0f850a000000 jne 0x2d
;; 23: ba00000000 mov edx, 0
;; 28: e902000000 jmp 0x2f
;; 2d: f7f9 idiv ecx
;; 2f: 4889d0 mov rax, rdx
;; 32: 5d pop rbp

View File

@@ -17,11 +17,11 @@
;; 16: 83f900 cmp ecx, 0
;; 19: 0f8502000000 jne 0x21
;; 1f: 0f0b ud2
;; 21: 83f9ff cmp ecx, -1
;; 24: 0f850a000000 jne 0x34
;; 2a: b800000000 mov eax, 0
;; 2f: e903000000 jmp 0x37
;; 34: 99 cdq
;; 21: 99 cdq
;; 22: 83f9ff cmp ecx, -1
;; 25: 0f850a000000 jne 0x35
;; 2b: ba00000000 mov edx, 0
;; 30: e902000000 jmp 0x37
;; 35: f7f9 idiv ecx
;; 37: 4889d0 mov rax, rdx
;; 3a: 4883c408 add rsp, 8

View File

@@ -14,11 +14,11 @@
;; e: 83f900 cmp ecx, 0
;; 11: 0f8502000000 jne 0x19
;; 17: 0f0b ud2
;; 19: 83f9ff cmp ecx, -1
;; 1c: 0f850a000000 jne 0x2c
;; 22: b800000000 mov eax, 0
;; 27: e903000000 jmp 0x2f
;; 2c: 99 cdq
;; 19: 99 cdq
;; 1a: 83f9ff cmp ecx, -1
;; 1d: 0f850a000000 jne 0x2d
;; 23: ba00000000 mov edx, 0
;; 28: e902000000 jmp 0x2f
;; 2d: f7f9 idiv ecx
;; 2f: 4889d0 mov rax, rdx
;; 32: 5d pop rbp

View File

@@ -14,8 +14,8 @@
;; e: 83f900 cmp ecx, 0
;; 11: 0f8502000000 jne 0x19
;; 17: 0f0b ud2
;; 19: ba00000000 mov edx, 0
;; 1e: f7f1 div ecx
;; 20: 4889d0 mov rax, rdx
;; 23: 5d pop rbp
;; 24: c3 ret
;; 19: 31d2 xor edx, edx
;; 1b: f7f1 div ecx
;; 1d: 4889d0 mov rax, rdx
;; 20: 5d pop rbp
;; 21: c3 ret

View File

@@ -14,8 +14,8 @@
;; e: 83f900 cmp ecx, 0
;; 11: 0f8502000000 jne 0x19
;; 17: 0f0b ud2
;; 19: ba00000000 mov edx, 0
;; 1e: f7f1 div ecx
;; 20: 4889d0 mov rax, rdx
;; 23: 5d pop rbp
;; 24: c3 ret
;; 19: 31d2 xor edx, edx
;; 1b: f7f1 div ecx
;; 1d: 4889d0 mov rax, rdx
;; 20: 5d pop rbp
;; 21: c3 ret

View File

@@ -17,9 +17,9 @@
;; 16: 83f900 cmp ecx, 0
;; 19: 0f8502000000 jne 0x21
;; 1f: 0f0b ud2
;; 21: ba00000000 mov edx, 0
;; 26: f7f1 div ecx
;; 28: 4889d0 mov rax, rdx
;; 2b: 4883c408 add rsp, 8
;; 2f: 5d pop rbp
;; 30: c3 ret
;; 21: 31d2 xor edx, edx
;; 23: f7f1 div ecx
;; 25: 4889d0 mov rax, rdx
;; 28: 4883c408 add rsp, 8
;; 2c: 5d pop rbp
;; 2d: c3 ret

View File

@@ -14,8 +14,8 @@
;; e: 83f900 cmp ecx, 0
;; 11: 0f8502000000 jne 0x19
;; 17: 0f0b ud2
;; 19: ba00000000 mov edx, 0
;; 1e: f7f1 div ecx
;; 20: 4889d0 mov rax, rdx
;; 23: 5d pop rbp
;; 24: c3 ret
;; 19: 31d2 xor edx, edx
;; 1b: f7f1 div ecx
;; 1d: 4889d0 mov rax, rdx
;; 20: 5d pop rbp
;; 21: c3 ret

View File

@@ -14,8 +14,8 @@
;; e: 83f900 cmp ecx, 0
;; 11: 0f8502000000 jne 0x19
;; 17: 0f0b ud2
;; 19: ba00000000 mov edx, 0
;; 1e: f7f1 div ecx
;; 20: 4889d0 mov rax, rdx
;; 23: 5d pop rbp
;; 24: c3 ret
;; 19: 31d2 xor edx, edx
;; 1b: f7f1 div ecx
;; 1d: 4889d0 mov rax, rdx
;; 20: 5d pop rbp
;; 21: c3 ret

View File

@@ -14,7 +14,7 @@
;; 12: 4883f900 cmp rcx, 0
;; 16: 0f8502000000 jne 0x1e
;; 1c: 0f0b ud2
;; 1e: ba00000000 mov edx, 0
;; 23: 48f7f1 div rcx
;; 26: 5d pop rbp
;; 27: c3 ret
;; 1e: 4831d2 xor rdx, rdx
;; 21: 48f7f1 div rcx
;; 24: 5d pop rbp
;; 25: c3 ret

View File

@@ -14,7 +14,7 @@
;; 12: 4883f900 cmp rcx, 0
;; 16: 0f8502000000 jne 0x1e
;; 1c: 0f0b ud2
;; 1e: ba00000000 mov edx, 0
;; 23: 48f7f1 div rcx
;; 26: 5d pop rbp
;; 27: c3 ret
;; 1e: 4831d2 xor rdx, rdx
;; 21: 48f7f1 div rcx
;; 24: 5d pop rbp
;; 25: c3 ret

View File

@@ -17,8 +17,8 @@
;; 1a: 4883f900 cmp rcx, 0
;; 1e: 0f8502000000 jne 0x26
;; 24: 0f0b ud2
;; 26: ba00000000 mov edx, 0
;; 2b: 48f7f1 div rcx
;; 2e: 4883c410 add rsp, 0x10
;; 32: 5d pop rbp
;; 33: c3 ret
;; 26: 4831d2 xor rdx, rdx
;; 29: 48f7f1 div rcx
;; 2c: 4883c410 add rsp, 0x10
;; 30: 5d pop rbp
;; 31: c3 ret

View File

@@ -14,7 +14,7 @@
;; 12: 4883f900 cmp rcx, 0
;; 16: 0f8502000000 jne 0x1e
;; 1c: 0f0b ud2
;; 1e: ba00000000 mov edx, 0
;; 23: 48f7f1 div rcx
;; 26: 5d pop rbp
;; 27: c3 ret
;; 1e: 4831d2 xor rdx, rdx
;; 21: 48f7f1 div rcx
;; 24: 5d pop rbp
;; 25: c3 ret

View File

@@ -14,7 +14,7 @@
;; 12: 4883f900 cmp rcx, 0
;; 16: 0f8502000000 jne 0x1e
;; 1c: 0f0b ud2
;; 1e: ba00000000 mov edx, 0
;; 23: 48f7f1 div rcx
;; 26: 5d pop rbp
;; 27: c3 ret
;; 1e: 4831d2 xor rdx, rdx
;; 21: 48f7f1 div rcx
;; 24: 5d pop rbp
;; 25: c3 ret

View File

@@ -14,11 +14,11 @@
;; 12: 4883f900 cmp rcx, 0
;; 16: 0f8502000000 jne 0x1e
;; 1c: 0f0b ud2
;; 1e: 4883f9ff cmp rcx, -1
;; 22: 0f850a000000 jne 0x32
;; 28: b800000000 mov eax, 0
;; 2d: e905000000 jmp 0x37
;; 32: 4899 cqo
;; 1e: 4899 cqo
;; 20: 4883f9ff cmp rcx, -1
;; 24: 0f850a000000 jne 0x34
;; 2a: ba00000000 mov edx, 0
;; 2f: e903000000 jmp 0x37
;; 34: 48f7f9 idiv rcx
;; 37: 4889d0 mov rax, rdx
;; 3a: 5d pop rbp

View File

@@ -14,11 +14,11 @@
;; 12: 4883f900 cmp rcx, 0
;; 16: 0f8502000000 jne 0x1e
;; 1c: 0f0b ud2
;; 1e: 4883f9ff cmp rcx, -1
;; 22: 0f850a000000 jne 0x32
;; 28: b800000000 mov eax, 0
;; 2d: e905000000 jmp 0x37
;; 32: 4899 cqo
;; 1e: 4899 cqo
;; 20: 4883f9ff cmp rcx, -1
;; 24: 0f850a000000 jne 0x34
;; 2a: ba00000000 mov edx, 0
;; 2f: e903000000 jmp 0x37
;; 34: 48f7f9 idiv rcx
;; 37: 4889d0 mov rax, rdx
;; 3a: 5d pop rbp

View File

@@ -15,11 +15,11 @@
;; 15: 4883f900 cmp rcx, 0
;; 19: 0f8502000000 jne 0x21
;; 1f: 0f0b ud2
;; 21: 4883f9ff cmp rcx, -1
;; 25: 0f850a000000 jne 0x35
;; 2b: b800000000 mov eax, 0
;; 30: e905000000 jmp 0x3a
;; 35: 4899 cqo
;; 21: 4899 cqo
;; 23: 4883f9ff cmp rcx, -1
;; 27: 0f850a000000 jne 0x37
;; 2d: ba00000000 mov edx, 0
;; 32: e903000000 jmp 0x3a
;; 37: 48f7f9 idiv rcx
;; 3a: 4889d0 mov rax, rdx
;; 3d: 5d pop rbp

View File

@@ -17,11 +17,11 @@
;; 1a: 4883f900 cmp rcx, 0
;; 1e: 0f8502000000 jne 0x26
;; 24: 0f0b ud2
;; 26: 4883f9ff cmp rcx, -1
;; 2a: 0f850a000000 jne 0x3a
;; 30: b800000000 mov eax, 0
;; 35: e905000000 jmp 0x3f
;; 3a: 4899 cqo
;; 26: 4899 cqo
;; 28: 4883f9ff cmp rcx, -1
;; 2c: 0f850a000000 jne 0x3c
;; 32: ba00000000 mov edx, 0
;; 37: e903000000 jmp 0x3f
;; 3c: 48f7f9 idiv rcx
;; 3f: 4889d0 mov rax, rdx
;; 42: 4883c410 add rsp, 0x10

View File

@@ -14,11 +14,11 @@
;; 12: 4883f900 cmp rcx, 0
;; 16: 0f8502000000 jne 0x1e
;; 1c: 0f0b ud2
;; 1e: 4883f9ff cmp rcx, -1
;; 22: 0f850a000000 jne 0x32
;; 28: b800000000 mov eax, 0
;; 2d: e905000000 jmp 0x37
;; 32: 4899 cqo
;; 1e: 4899 cqo
;; 20: 4883f9ff cmp rcx, -1
;; 24: 0f850a000000 jne 0x34
;; 2a: ba00000000 mov edx, 0
;; 2f: e903000000 jmp 0x37
;; 34: 48f7f9 idiv rcx
;; 37: 4889d0 mov rax, rdx
;; 3a: 5d pop rbp

View File

@@ -14,8 +14,8 @@
;; 12: 4883f900 cmp rcx, 0
;; 16: 0f8502000000 jne 0x1e
;; 1c: 0f0b ud2
;; 1e: ba00000000 mov edx, 0
;; 23: 48f7f1 div rcx
;; 26: 4889d0 mov rax, rdx
;; 29: 5d pop rbp
;; 2a: c3 ret
;; 1e: 4831d2 xor rdx, rdx
;; 21: 48f7f1 div rcx
;; 24: 4889d0 mov rax, rdx
;; 27: 5d pop rbp
;; 28: c3 ret

View File

@@ -14,8 +14,8 @@
;; 12: 4883f900 cmp rcx, 0
;; 16: 0f8502000000 jne 0x1e
;; 1c: 0f0b ud2
;; 1e: ba00000000 mov edx, 0
;; 23: 48f7f1 div rcx
;; 26: 4889d0 mov rax, rdx
;; 29: 5d pop rbp
;; 2a: c3 ret
;; 1e: 4831d2 xor rdx, rdx
;; 21: 48f7f1 div rcx
;; 24: 4889d0 mov rax, rdx
;; 27: 5d pop rbp
;; 28: c3 ret

View File

@@ -17,9 +17,9 @@
;; 1a: 4883f900 cmp rcx, 0
;; 1e: 0f8502000000 jne 0x26
;; 24: 0f0b ud2
;; 26: ba00000000 mov edx, 0
;; 2b: 48f7f1 div rcx
;; 2e: 4889d0 mov rax, rdx
;; 31: 4883c410 add rsp, 0x10
;; 35: 5d pop rbp
;; 36: c3 ret
;; 26: 4831d2 xor rdx, rdx
;; 29: 48f7f1 div rcx
;; 2c: 4889d0 mov rax, rdx
;; 2f: 4883c410 add rsp, 0x10
;; 33: 5d pop rbp
;; 34: c3 ret

View File

@@ -14,8 +14,8 @@
;; 12: 4883f900 cmp rcx, 0
;; 16: 0f8502000000 jne 0x1e
;; 1c: 0f0b ud2
;; 1e: ba00000000 mov edx, 0
;; 23: 48f7f1 div rcx
;; 26: 4889d0 mov rax, rdx
;; 29: 5d pop rbp
;; 2a: c3 ret
;; 1e: 4831d2 xor rdx, rdx
;; 21: 48f7f1 div rcx
;; 24: 4889d0 mov rax, rdx
;; 27: 5d pop rbp
;; 28: c3 ret

View File

@@ -14,8 +14,8 @@
;; 12: 4883f900 cmp rcx, 0
;; 16: 0f8502000000 jne 0x1e
;; 1c: 0f0b ud2
;; 1e: ba00000000 mov edx, 0
;; 23: 48f7f1 div rcx
;; 26: 4889d0 mov rax, rdx
;; 29: 5d pop rbp
;; 2a: c3 ret
;; 1e: 4831d2 xor rdx, rdx
;; 21: 48f7f1 div rcx
;; 24: 4889d0 mov rax, rdx
;; 27: 5d pop rbp
;; 28: c3 ret