@@ -361,10 +361,10 @@ Lemma eval_sel_select:
361361 /\ Val.lessdef (Val.select (Some b) v2 v3 ty) v.
362362Proof .
363363 unfold sel_select; intros.
364- specialize (eval_condition_of_expr _ _ _ _ H H2).
364+ specialize (eval_condition_of_expr _ _ _ _ H H2).
365365 destruct (condition_of_expr a1) as [cond args]; simpl fst; simpl snd. intros (vl & A & B).
366- destruct (select ty cond args a2 a3) as [a|] eqn:SEL .
367- - exploit eval_select; eauto. rewrite B. auto.
366+ destruct (select_supported ty) eqn:SUP .
367+ - rewrite <- B. eapply eval_select; eauto.
368368- exists (if b then v2 else v3); split.
369369 econstructor; eauto. eapply eval_condexpr_of_expr; eauto. destruct b; auto.
370370 apply Val.lessdef_normalize.
@@ -776,27 +776,29 @@ Proof.
776776 exists (v1' :: vl'); split; auto. constructor; eauto.
777777Qed .
778778
779- Lemma sel_select_opt_correct :
780- forall ty cond a1 a2 a sp e m vcond v1 v2 b e' m' le,
781- sel_select_opt ty cond a1 a2 = Some a ->
779+ Lemma sel_select_expr_correct :
780+ forall ty cond a1 a2 sp e m vcond v1 v2 b e' m' le,
781+ SelectOp.select_supported ty = true ->
782782 Cminor.eval_expr ge sp e m cond vcond ->
783783 Cminor.eval_expr ge sp e m a1 v1 ->
784784 Cminor.eval_expr ge sp e m a2 v2 ->
785785 Val.bool_of_val vcond b ->
786786 env_lessdef e e' -> Mem.extends m m' ->
787- exists v', eval_expr tge sp e' m' le a v' /\ Val.lessdef (Val.select (Some b) v1 v2 ty) v'.
787+ exists v', eval_expr tge sp e' m' le (sel_select_expr ty cond a1 a2) v'
788+ /\ Val.lessdef (Val.select (Some b) v1 v2 ty) v'.
788789Proof .
789- unfold sel_select_opt ; intros.
790+ unfold sel_select_expr ; intros.
790791 destruct (condition_of_expr (sel_expr cond)) as [cnd args] eqn:C.
791792 exploit sel_expr_correct. eexact H0. eauto. eauto. intros (vcond' & EVC & LDC).
792793 exploit sel_expr_correct. eexact H1. eauto. eauto. intros (v1' & EV1 & LD1).
793794 exploit sel_expr_correct. eexact H2. eauto. eauto. intros (v2' & EV2 & LD2).
794795 assert (Val.bool_of_val vcond' b) by (inv H3; inv LDC; constructor).
795796 exploit eval_condition_of_expr. eexact EVC. eauto. rewrite C. intros (vargs' & EVARGS & EVCOND).
796- exploit eval_select; eauto. intros (v' & X & Y).
797+ exploit (eval_select tge sp e' m' le ty cnd args vargs' (sel_expr a1) v1' (sel_expr a2) v2'); eauto.
798+ simpl in EVCOND; rewrite EVCOND. intros (v' & X & Y).
797799 exists v'; split; eauto.
798800 eapply Val.lessdef_trans; [|eexact Y].
799- apply Val.select_lessdef ; auto.
801+ apply Val.normalize_lessdef. destruct b ; auto.
800802Qed .
801803
802804Lemma sel_builtin_arg_correct:
@@ -984,17 +986,15 @@ Lemma if_conversion_base_correct:
984986 E0 (State tf Sskip tk sp (PTree.set id v' e') m').
985987Proof .
986988 unfold if_conversion_base; intros. rewrite H2 in H. clear H2.
987- destruct andb eqn:C; try discriminate.
988- destruct (sel_select_opt ty cond ifso ifnot) as [a'|] eqn:SSO; simpl in H; inv H.
989- InvBooleans.
989+ destruct andb eqn:C; inv H. InvBooleans.
990990 destruct (eval_safe_expr ge f sp e m ifso) as (v1 & EV1); auto.
991991 destruct (eval_safe_expr ge f sp e m ifnot) as (v2 & EV2); auto.
992992 assert (TY1: Val.has_type v1 ty) by (eapply wt_eval_expr; eauto).
993993 assert (TY2: Val.has_type v2 ty) by (eapply wt_eval_expr; eauto).
994- exploit sel_select_opt_correct ; eauto. intros (v' & EV' & LD).
994+ exploit (sel_select_expr_correct ty cond ifso ifnot) ; eauto. intros (v' & EV & LD).
995995 simpl in LD. rewrite Val.normalize_idem in LD by (destruct b; auto).
996996 exists v1, v2, v'; intuition auto.
997- constructor. eexact EV' .
997+ constructor. exact EV.
998998Qed .
999999
10001000Lemma if_conversion_correct:
@@ -1176,8 +1176,7 @@ Lemma if_conversion_base_nolabel: forall (hf: helper_functions) ki env a id a1 a
11761176 nolabel' s.
11771177Proof .
11781178 unfold if_conversion_base; intros.
1179- destruct andb; try discriminate.
1180- destruct (sel_select_opt (env id) a a1 a2); inv H.
1179+ destruct andb; inv H.
11811180 red; auto.
11821181Qed .
11831182
0 commit comments