From 0b927a1f21a6a0b7c2d8ef99457b2d5c32ca181d Mon Sep 17 00:00:00 2001 From: xleroy Date: Fri, 11 Apr 2014 13:45:43 +0000 Subject: ia32/Select*: complete the modifications to shifts. Makefile: missing "clean" actions. Makefile/pg/coq: honor $COQBIN if set (as suggested by P. Boutillier) to facilitate testing with different Coq versions. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2453 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- Makefile | 15 ++++++++------- coq | 2 +- ia32/SelectOp.vp | 8 ++++---- ia32/SelectOpproof.v | 24 ++++++++++++++++-------- pg | 2 +- 5 files changed, 30 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 87a4977..7c0681a 100644 --- a/Makefile +++ b/Makefile @@ -26,11 +26,11 @@ COQINCLUDES=$(foreach d, $(RECDIRS), -R $(d) -as compcert.$(d)) \ CAMLINCLUDES=$(patsubst %,-I %, $(DIRS)) -I extraction -I cparser -COQC=coqc -q $(COQINCLUDES) -COQDEP=coqdep $(COQINCLUDES) -COQDOC=coqdoc -COQEXEC=coqtop $(COQINCLUDES) -batch -load-vernac-source -COQCHK=coqchk $(COQINCLUDES) +COQC="$(COQBIN)coqc" -q $(COQINCLUDES) +COQDEP="$(COQBIN)coqdep" $(COQINCLUDES) +COQDOC="$(COQBIN)coqdoc" +COQEXEC="$(COQBIN)coqtop" $(COQINCLUDES) -batch -load-vernac-source +COQCHK="$(COQBIN)coqchk" $(COQINCLUDES) OCAMLBUILD=ocamlbuild OCB_OPTIONS=\ @@ -243,10 +243,11 @@ clean: rm -f ccomp ccomp.byte cchecklink cchecklink.byte clightgen clightgen.byte rm -rf _build rm -rf doc/html doc/*.glob - rm -f doc/coq2html.ml doc/coq2html + rm -f doc/coq2html.ml doc/coq2html doc/*.cm? doc/*.o rm -f driver/Configuration.ml rm -f extraction/STAMP extraction/*.ml extraction/*.mli - rm -f tools/ndfun + rm -f tools/ndfun tools/*.cm? tools/*.o + rm -f $(ARCH)/ConstpropOp.v $(ARCH)/SelectOp.v backend/SelectDiv.v backend/SelectLong.v $(MAKE) -C runtime clean $(MAKE) -C test clean diff --git a/coq b/coq index ea08805..0b04a8c 100755 --- a/coq +++ b/coq @@ -12,4 +12,4 @@ make -q ${1}o || { done) } -coqide $INCLUDES $1 && make ${1}o +"${COQBIN}coqide" $INCLUDES $1 && make ${1}o diff --git a/ia32/SelectOp.vp b/ia32/SelectOp.vp index e82d0a3..214608e 100644 --- a/ia32/SelectOp.vp +++ b/ia32/SelectOp.vp @@ -144,9 +144,9 @@ Definition shift_is_scale (n: int) : bool := Int.eq n (Int.repr 1) || Int.eq n (Int.repr 2) || Int.eq n (Int.repr 3). Nondetfunction shlimm (e1: expr) (n: int) := - if Int.eq n Int.zero then e1 + if Int.eq n Int.zero then e1 else if negb (Int.ltu n Int.iwordsize) then - Eop Oshl (e1:::Eop (Ointconst n):::Enil) + Eop Oshl (e1:::Eop (Ointconst n) Enil:::Enil) else match e1 with | Eop (Ointconst n1) Enil => @@ -168,7 +168,7 @@ Nondetfunction shlimm (e1: expr) (n: int) := Nondetfunction shruimm (e1: expr) (n: int) := if Int.eq n Int.zero then e1 else if negb (Int.ltu n Int.iwordsize) then - Eop Oshru (e1:::Eop (Ointconst n):::Enil) + Eop Oshru (e1:::Eop (Ointconst n) Enil:::Enil) else match e1 with | Eop (Ointconst n1) Enil => @@ -184,7 +184,7 @@ Nondetfunction shruimm (e1: expr) (n: int) := Nondetfunction shrimm (e1: expr) (n: int) := if Int.eq n Int.zero then e1 else if negb (Int.ltu n Int.iwordsize) then - Eop Oshr (e1:::Eop (Ointconst n):::Enil) + Eop Oshr (e1:::Eop (Ointconst n) Enil:::Enil) else match e1 with | Eop (Ointconst n1) Enil => diff --git a/ia32/SelectOpproof.v b/ia32/SelectOpproof.v index 16879c0..b528a72 100644 --- a/ia32/SelectOpproof.v +++ b/ia32/SelectOpproof.v @@ -213,9 +213,10 @@ Proof. red; intros until x. unfold shlimm. predSpec Int.eq Int.eq_spec n Int.zero. intros; subst. exists x; split; auto. destruct x; simpl; auto. rewrite Int.shl_zero; auto. + destruct (Int.ltu n Int.iwordsize) eqn:LT; simpl. destruct (shlimm_match a); intros; InvEval. exists (Vint (Int.shl n1 n)); split. EvalOp. - simpl. destruct (Int.ltu n Int.iwordsize); auto. + simpl. rewrite LT. auto. destruct (Int.ltu (Int.add n n1) Int.iwordsize) eqn:?. exists (Val.shl v1 (Vint (Int.add n n1))); split. EvalOp. subst. destruct v1; simpl; auto. @@ -227,14 +228,16 @@ Proof. simpl. auto. subst. destruct (shift_is_scale n). econstructor; split. EvalOp. simpl. eauto. - destruct v1; simpl; auto. destruct (Int.ltu n Int.iwordsize); auto. + destruct v1; simpl; auto. rewrite LT. rewrite Int.shl_mul. rewrite Int.mul_add_distr_l. rewrite (Int.shl_mul n1). auto. TrivialExists. econstructor. EvalOp. simpl; eauto. constructor. auto. destruct (shift_is_scale n). econstructor; split. EvalOp. simpl. eauto. - destruct x; simpl; auto. destruct (Int.ltu n Int.iwordsize); auto. + destruct x; simpl; auto. rewrite LT. rewrite Int.add_zero. rewrite Int.shl_mul. auto. TrivialExists. + intros; TrivialExists. constructor. eauto. constructor. EvalOp. simpl; eauto. constructor. + auto. Qed. Theorem eval_shruimm: @@ -244,19 +247,21 @@ Proof. red; intros until x. unfold shruimm. predSpec Int.eq Int.eq_spec n Int.zero. intros; subst. exists x; split; auto. destruct x; simpl; auto. rewrite Int.shru_zero; auto. + destruct (Int.ltu n Int.iwordsize) eqn:LT; simpl. destruct (shruimm_match a); intros; InvEval. exists (Vint (Int.shru n1 n)); split. EvalOp. - simpl. destruct (Int.ltu n Int.iwordsize); auto. + simpl. rewrite LT; auto. destruct (Int.ltu (Int.add n n1) Int.iwordsize) eqn:?. exists (Val.shru v1 (Vint (Int.add n n1))); split. EvalOp. subst. destruct v1; simpl; auto. rewrite Heqb. destruct (Int.ltu n1 Int.iwordsize) eqn:?; simpl; auto. - destruct (Int.ltu n Int.iwordsize) eqn:?; simpl; auto. - rewrite Int.add_commut. rewrite Int.shru_shru; auto. rewrite Int.add_commut; auto. + rewrite LT. rewrite Int.add_commut. rewrite Int.shru_shru; auto. rewrite Int.add_commut; auto. subst. TrivialExists. econstructor. EvalOp. simpl; eauto. constructor. simpl. auto. TrivialExists. + intros; TrivialExists. constructor. eauto. constructor. EvalOp. simpl; eauto. constructor. + auto. Qed. Theorem eval_shrimm: @@ -266,19 +271,22 @@ Proof. red; intros until x. unfold shrimm. predSpec Int.eq Int.eq_spec n Int.zero. intros; subst. exists x; split; auto. destruct x; simpl; auto. rewrite Int.shr_zero; auto. + destruct (Int.ltu n Int.iwordsize) eqn:LT; simpl. destruct (shrimm_match a); intros; InvEval. exists (Vint (Int.shr n1 n)); split. EvalOp. - simpl. destruct (Int.ltu n Int.iwordsize); auto. + simpl. rewrite LT; auto. destruct (Int.ltu (Int.add n n1) Int.iwordsize) eqn:?. exists (Val.shr v1 (Vint (Int.add n n1))); split. EvalOp. subst. destruct v1; simpl; auto. rewrite Heqb. destruct (Int.ltu n1 Int.iwordsize) eqn:?; simpl; auto. - destruct (Int.ltu n Int.iwordsize) eqn:?; simpl; auto. + rewrite LT. rewrite Int.add_commut. rewrite Int.shr_shr; auto. rewrite Int.add_commut; auto. subst. TrivialExists. econstructor. EvalOp. simpl; eauto. constructor. simpl. auto. TrivialExists. + intros; TrivialExists. constructor. eauto. constructor. EvalOp. simpl; eauto. constructor. + auto. Qed. Lemma eval_mulimm_base: diff --git a/pg b/pg index 33a70ce..28926ba 100755 --- a/pg +++ b/pg @@ -13,7 +13,7 @@ make -q ${1}o || { done) } -COQPROGNAME="coqtop" +COQPROGNAME="${COQBIN}coqtop" COQPROGARGS="" for arg in $INCLUDES; do -- cgit v1.2.3