(** Translation of conditional branches *)

(* Specifications: *)
Lemma transl_cbranch_int32s_correct:
forall cmp r1 r2 lbl (rs: regset) m b,
Val.cmp_bool cmp rs##r1 rs##r2 = Some b ->
exec_instr ge fn (transl_cbranch_int32s cmp r1 r2 lbl) rs m =
eval_branch fn lbl rs m (Some b).
Lemma transl_cbranch_int32u_correct:
forall cmp r1 r2 lbl (rs: regset) m b,
Val.cmpu_bool (Mem.valid_pointer m) cmp rs##r1 rs##r2 = Some b ->
exec_instr ge fn (transl_cbranch_int32u cmp r1 r2 lbl) rs m =
eval_branch fn lbl rs m (Some b).
Lemma transl_cbranch_int64s_correct:
forall cmp r1 r2 lbl (rs: regset) m b,
Val.cmpl_bool cmp rs###r1 rs###r2 = Some b ->
exec_instr ge fn (transl_cbranch_int64s cmp r1 r2 lbl) rs m =
eval_branch fn lbl rs m (Some b).
Lemma transl_cbranch_int64u_correct:
forall cmp r1 r2 lbl (rs: regset) m b,
Val.cmplu_bool (Mem.valid_pointer m) cmp rs###r1 rs###r2 = Some b ->
exec_instr ge fn (transl_cbranch_int64u cmp r1 r2 lbl) rs m =
eval_branch fn lbl rs m (Some b).
Lemma transl_cond_float_correct:
forall (rs: regset) m cmp rd r1 r2 insn normal v,
transl_cond_float cmp rd r1 r2 = (insn, normal) ->
v = (if normal then Val.cmpf cmp rs#r1 rs#r2 else Val.notbool (Val.cmpf cmp rs#r1 rs#r2)) ->
exec_instr ge fn insn rs m = Next (nextinstr (rs#rd <- v)) m.
Lemma transl_cond_single_correct:
forall (rs: regset) m cmp rd r1 r2 insn normal v,
transl_cond_single cmp rd r1 r2 = (insn, normal) ->
v = (if normal then Val.cmpfs cmp rs#r1 rs#r2 else Val.notbool (Val.cmpfs cmp rs#r1 rs#r2)) ->
exec_instr ge fn insn rs m = Next (nextinstr (rs#rd <- v)) m.