This commit is contained in:
Nicolas PENELOUX 2024-01-01 22:27:54 +01:00
parent 5a17c4164e
commit f86829dd3a

View file

@ -477,8 +477,12 @@ module InstructionSelector : InstructionSelector = struct
;;
let div ~dst ~srcl ~srcr =
(* TODO *)
failwith "Students! This is your job! (div)"
(* Division *)
let rax = `Reg X86_64_Architecture.RAX in
mov ~src:srcl ~dst:rax
@ mov ~src:srcr ~dst:r15
@ [ Instruction cqto; Instruction (idivq ~src:r15)]
@ mov ~dst ~src:rax
;;
let andl ~dst ~srcl ~srcr =