summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-02-24 16:43:38 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-02-24 16:43:38 +0000
commit62316a8e94d8cdcbf9e7aeadd1caf8e29507e6b0 (patch)
tree39b77b415e5387e8df643e18a206b7f1ffdaf329 /backend
parent91dcfe11ff321386f7924da053be83523073a50c (diff)
Take advantage of Cmaskzero and Cmasknotzero.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1825 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'backend')
-rw-r--r--backend/Selection.v5
-rw-r--r--backend/Selectionproof.v20
2 files changed, 14 insertions, 11 deletions
diff --git a/backend/Selection.v b/backend/Selection.v
index 2d6c901..ef627d7 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 9681c66..b5bc216 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).