Section CONSTRUCTORS.
Variable ge: genv.
Variable fn: function.
(** Smart constructor for moves. *)
(** Properties of division *)
(** Smart constructor for [shrx] *)
(** Smart constructor for [shrxl] *)
(** Smart constructor for integer conversions *)
(** Smart constructor for small stores *)
(** Accessing slots in the stack frame *)
Remark eval_addrmode_indexed:
forall (base: ireg) ofs (rs: regset),
match rs#base with Vptr _ _ => True | _ => False end ->
eval_addrmode ge (Addrmode (Some base) None (inl _ (Ptrofs.unsigned ofs))) rs = Val.offset_ptr rs#base ofs.
Ltac loadind_correct_solve :=
match goal with
| H: Error _ = OK _ |- _ => discriminate H
| H: OK _ = OK _ |- _ => inv H
| H: match ?x with _ => _ end = OK _ |- _ => destruct x eqn:?; loadind_correct_solve
| _ => idtac
end.
(** Translation of addressing modes *)
(** Processor conditions and comparisons *)
Definition eval_extcond (xc: extcond) (rs: regset) : option bool :=
match xc with
| Cond_base c =>
eval_testcond c rs
| Cond_and c1 c2 =>
match eval_testcond c1 rs, eval_testcond c2 rs with
| Some b1, Some b2 => Some (b1 && b2)
| _, _ => None
end
| Cond_or c1 c2 =>
match eval_testcond c1 rs, eval_testcond c2 rs with
| Some b1, Some b2 => Some (b1 || b2)
| _, _ => None
end
end.
Definition swap_floats {A: Type} (c: comparison) (n1 n2: A) : A :=
match c with
| Clt | Cle => n2
| Ceq | Cne | Cgt | Cge => n1
end.

Lemma testcond_for_float_comparison_correct:
forall c n1 n2 rs,
eval_extcond (testcond_for_condition (Ccompf c))
(nextinstr (compare_floats (Vfloat (swap_floats c n1 n2))
(Vfloat (swap_floats c n2 n1)) rs)) =
Some(Float.cmp c n1 n2).