From 4297fcb821c3188449b64184af73e41491a6118f Mon Sep 17 00:00:00 2001 From: xleroy Date: Mon, 23 Jul 2012 15:01:54 +0000 Subject: - Revised non-overflow constraints on memory injections so that injections compose (Values, Memdata, Memory) - Memory chunks: Mfloat64 now has alignment 8; introduced Mfloat64al32 that works like old Mfloat64 (i.e. has alignment 4); simplified handling of memcpy builtin accordingly. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1983 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- powerpc/Asm.v | 10 +++++----- powerpc/Asmgen.v | 4 ++-- powerpc/Asmgenproof.v | 9 +++++++-- powerpc/PrintAsm.ml | 4 ++-- powerpc/eabi/Stacklayout.v | 5 ++--- 5 files changed, 18 insertions(+), 14 deletions(-) (limited to 'powerpc') diff --git a/powerpc/Asm.v b/powerpc/Asm.v index ea5e4162..5d815fda 100644 --- a/powerpc/Asm.v +++ b/powerpc/Asm.v @@ -647,9 +647,9 @@ Definition exec_instr (c: code) (i: instruction) (rs: regset) (m: mem) : outcome | Plbzx rd r1 r2 => load2 Mint8unsigned rd r1 r2 rs m | Plfd rd cst r1 => - load1 Mfloat64 rd cst r1 rs m + load1 Mfloat64al32 rd cst r1 rs m | Plfdx rd r1 r2 => - load2 Mfloat64 rd r1 r2 rs m + load2 Mfloat64al32 rd r1 r2 rs m | Plfs rd cst r1 => load1 Mfloat32 rd cst r1 rs m | Plfsx rd r1 r2 => @@ -712,9 +712,9 @@ Definition exec_instr (c: code) (i: instruction) (rs: regset) (m: mem) : outcome | Pstbx rd r1 r2 => store2 Mint8unsigned rd r1 r2 rs m | Pstfd rd cst r1 => - store1 Mfloat64 rd cst r1 rs m + store1 Mfloat64al32 rd cst r1 rs m | Pstfdx rd r1 r2 => - store2 Mfloat64 rd r1 r2 rs m + store2 Mfloat64al32 rd r1 r2 rs m | Pstfs rd cst r1 => match store1 Mfloat32 rd cst r1 rs m with | OK rs' m' => OK (rs'#FPR13 <- Vundef) m' @@ -814,7 +814,7 @@ Inductive extcall_arg (rs: regset) (m: mem): loc -> val -> Prop := extcall_arg rs m (S (Outgoing ofs Tint)) v | extcall_arg_float_stack: forall ofs bofs v, bofs = Stacklayout.fe_ofs_arg + 4 * ofs -> - Mem.loadv Mfloat64 m (Val.add (rs (IR GPR1)) (Vint (Int.repr bofs))) = Some v -> + Mem.loadv Mfloat64al32 m (Val.add (rs (IR GPR1)) (Vint (Int.repr bofs))) = Some v -> extcall_arg rs m (S (Outgoing ofs Tfloat)) v. Definition extcall_arguments diff --git a/powerpc/Asmgen.v b/powerpc/Asmgen.v index f9e4b2cd..b34d9395 100644 --- a/powerpc/Asmgen.v +++ b/powerpc/Asmgen.v @@ -485,7 +485,7 @@ Definition transl_instr (f: Mach.function) (i: Mach.instruction) (k: code) := | Mfloat32 => transl_load_store (Plfs (freg_of dst)) (Plfsx (freg_of dst)) addr args GPR12 k - | Mfloat64 => + | Mfloat64 | Mfloat64al32 => transl_load_store (Plfd (freg_of dst)) (Plfdx (freg_of dst)) addr args GPR12 k end @@ -510,7 +510,7 @@ Definition transl_instr (f: Mach.function) (i: Mach.instruction) (k: code) := | Mfloat32 => transl_load_store (Pstfs (freg_of src)) (Pstfsx (freg_of src)) addr args temp k - | Mfloat64 => + | Mfloat64 | Mfloat64al32 => transl_load_store (Pstfd (freg_of src)) (Pstfdx (freg_of src)) addr args temp k end diff --git a/powerpc/Asmgenproof.v b/powerpc/Asmgenproof.v index e7b73854..e99049c2 100644 --- a/powerpc/Asmgenproof.v +++ b/powerpc/Asmgenproof.v @@ -827,9 +827,9 @@ Proof. rewrite <- H. apply eval_addressing_preserved. exact symbols_preserved. left; eapply exec_straight_steps; eauto with coqlib; destruct chunk; simpl; simpl in H6; - (* all cases but Mint8signed *) + (* all cases but Mint8signed and Mfloat64 *) try (eapply transl_load_correct; eauto; - intros; simpl; unfold preg_of; rewrite H6; auto). + intros; simpl; unfold preg_of; rewrite H6; auto; fail). (* Mint8signed *) exploit loadv_8_signed_unsigned; eauto. intros [v' [LOAD EQ]]. assert (X1: forall (cst : constant) (r1 : ireg) (rs1 : regset), @@ -849,6 +849,10 @@ Proof. eapply agree_set_twice_mireg; eauto. rewrite EQ. apply Val.sign_ext_lessdef. generalize (ireg_val _ _ _ dst AG1 H6). rewrite Regmap.gss. auto. + (* Mfloat64 *) + exploit Mem.loadv_float64al32; eauto. intros. clear H0. + eapply transl_load_correct; eauto; + intros; simpl; unfold preg_of; rewrite H6; auto. Qed. Lemma storev_8_signed_unsigned: @@ -883,6 +887,7 @@ Proof. rewrite <- (eval_addressing_preserved _ _ symbols_preserved) in H. left; eapply exec_straight_steps_bis; eauto with coqlib. destruct chunk; simpl; simpl in H6; + try (generalize (Mem.storev_float64al32 _ _ _ _ H0); intros); try (rewrite storev_8_signed_unsigned in H0); try (rewrite storev_16_signed_unsigned in H0); simpl; eapply transl_store_correct; eauto; diff --git a/powerpc/PrintAsm.ml b/powerpc/PrintAsm.ml index 3331a1c2..ac9a5da4 100644 --- a/powerpc/PrintAsm.ml +++ b/powerpc/PrintAsm.ml @@ -350,7 +350,7 @@ let print_builtin_vload_common oc chunk base offset res = fprintf oc " lwz %a, %a(%a)\n" ireg res constant offset ireg base | Mfloat32, FR res -> fprintf oc " lfs %a, %a(%a)\n" freg res constant offset ireg base - | Mfloat64, FR res -> + | (Mfloat64 | Mfloat64al32), FR res -> fprintf oc " lfd %a, %a(%a)\n" freg res constant offset ireg base | _ -> assert false @@ -383,7 +383,7 @@ let print_builtin_vstore_common oc chunk base offset src = | Mfloat32, FR src -> fprintf oc " frsp %a, %a\n" freg FPR13 freg src; fprintf oc " stfs %a, %a(%a)\n" freg FPR13 constant offset ireg base - | Mfloat64, FR src -> + | (Mfloat64 | Mfloat64al32), FR src -> fprintf oc " stfd %a, %a(%a)\n" freg src constant offset ireg base | _ -> assert false diff --git a/powerpc/eabi/Stacklayout.v b/powerpc/eabi/Stacklayout.v index 22a28269..cd4d9ae4 100644 --- a/powerpc/eabi/Stacklayout.v +++ b/powerpc/eabi/Stacklayout.v @@ -113,7 +113,7 @@ Remark frame_env_aligned: /\ (8 | fe.(fe_ofs_float_local)) /\ (8 | fe.(fe_ofs_float_callee_save)) /\ (4 | fe.(fe_ofs_retaddr)) - /\ (4 | fe.(fe_stack_data)) + /\ (8 | fe.(fe_stack_data)) /\ (16 | fe.(fe_size)). Proof. intros. @@ -133,8 +133,7 @@ Proof. set (x5 := x4 + 8 * bound_float_local b). assert (8 | x5). unfold x5. apply Zdivide_plus_r; auto. exists (bound_float_local b); ring. set (x6 := x5 + 8 * bound_float_callee_save b). - assert (4 | x6). - apply Zdivides_trans with 8. exists 2; auto. + assert (8 | x6). unfold x6. apply Zdivide_plus_r; auto. exists (bound_float_callee_save b); ring. set (x7 := align (x6 + bound_stack_data b) 16). assert (16 | x7). unfold x7; apply align_divides. omega. -- cgit