From 62316a8e94d8cdcbf9e7aeadd1caf8e29507e6b0 Mon Sep 17 00:00:00 2001 From: xleroy Date: Fri, 24 Feb 2012 16:43:38 +0000 Subject: Take advantage of Cmaskzero and Cmasknotzero. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1825 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- backend/Selection.v | 5 ++++- backend/Selectionproof.v | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) (limited to 'backend') diff --git a/backend/Selection.v b/backend/Selection.v index 2d6c9017..ef627d79 100644 --- a/backend/Selection.v +++ b/backend/Selection.v @@ -62,6 +62,9 @@ Definition is_compare_eq_zero (c: condition) : bool := | _ => false end. +Definition condexpr_of_expr_base (e: expr) : condexpr := + let (c, args) := cond_of_expr e in CEcond c args. + Fixpoint condexpr_of_expr (e: expr) : condexpr := match e with | Eop (Ointconst n) Enil => @@ -78,7 +81,7 @@ Fixpoint condexpr_of_expr (e: expr) : condexpr := | Econdition ce e1 e2 => CEcondition ce (condexpr_of_expr e1) (condexpr_of_expr e2) | _ => - CEcond (Ccompuimm Cne Int.zero) (e:::Enil) + condexpr_of_expr_base e end. (** Conversion of loads and stores *) diff --git a/backend/Selectionproof.v b/backend/Selectionproof.v index 9681c66b..b5bc216b 100644 --- a/backend/Selectionproof.v +++ b/backend/Selectionproof.v @@ -81,17 +81,17 @@ Proof. intros. simpl. auto. Qed. -Lemma eval_base_condition_of_expr: +Lemma eval_condition_of_expr_base: forall le a v b, eval_expr ge sp e m le a v -> Val.bool_of_val v b -> - eval_condexpr ge sp e m le - (CEcond (Ccompuimm Cne Int.zero) (a ::: Enil)) - b. + eval_condexpr ge sp e m le (condexpr_of_expr_base a) b. Proof. - intros. - eapply eval_CEcond. eauto with evalexpr. - inversion H0; simpl. rewrite Int.eq_false; auto. auto. auto. + intros. unfold condexpr_of_expr_base. + exploit eval_cond_of_expr; eauto. + destruct (cond_of_expr a) as [cond args]. + intros [vl [A B]]. + econstructor; eauto. Qed. Lemma is_compare_neq_zero_correct: @@ -135,15 +135,15 @@ Lemma eval_condition_of_expr: Proof. intro a0; pattern a0. apply expr_induction_principle; simpl; intros; - try (eapply eval_base_condition_of_expr; eauto; fail). + try (eapply eval_condition_of_expr_base; eauto; fail). - destruct o; try (eapply eval_base_condition_of_expr; eauto; fail). + destruct o; try (eapply eval_condition_of_expr_base; eauto; fail). destruct e0. inv H0. inv H5. simpl in H7. inv H7. inversion H1. rewrite Int.eq_false; auto. constructor. subst i; rewrite Int.eq_true. constructor. - eapply eval_base_condition_of_expr; eauto. + eapply eval_condition_of_expr_base; eauto. inv H0. simpl in H7. assert (eval_condition c vl m = Some b). -- cgit