From 566f8e2d36c9ee6e6024b7a38b66e59a89a8ddd9 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Mon, 1 Jan 2024 20:38:19 +0100 Subject: [PATCH] 10/31 --- flap/src/x86-64/retrolixToX86_64.ml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/flap/src/x86-64/retrolixToX86_64.ml b/flap/src/x86-64/retrolixToX86_64.ml index 8e8d07f..32dd9e3 100644 --- a/flap/src/x86-64/retrolixToX86_64.ml +++ b/flap/src/x86-64/retrolixToX86_64.ml @@ -492,8 +492,15 @@ module InstructionSelector : InstructionSelector = struct ;; let conditional_jump ~cc ~srcl ~srcr ~ll ~lr = - (* TODO *) - failwith "Students! This is your job! (conditional_jump)" + (* Déplace src left vers r15 *) + [ Instruction (movq ~src:srcl ~dst:r15) + (* Compare src right avec r15 (= src left) ***) + ; Instruction (cmpq ~src1:srcr ~src2:r15) + (* Si condition est vrai jump vers le label ll *) + ; Instruction (jccl ~cc ~tgt:ll) + (* Sinon on va jump vers le label lr par défaut *****) + ; Instruction (jmpl ~tgt:lr) + ] ;; let switch ?default ~discriminant ~cases () =