aboutsummaryrefslogtreecommitdiffstats
path: root/aarch64/Asmgenproof1.v
diff options
context:
space:
mode:
Diffstat (limited to 'aarch64/Asmgenproof1.v')
-rw-r--r--aarch64/Asmgenproof1.v87
1 files changed, 85 insertions, 2 deletions
diff --git a/aarch64/Asmgenproof1.v b/aarch64/Asmgenproof1.v
index 0e36bd05..35f1f2d7 100644
--- a/aarch64/Asmgenproof1.v
+++ b/aarch64/Asmgenproof1.v
@@ -881,7 +881,40 @@ Proof.
split. subst v; Simpl.
split; intros; Simpl.
Qed.
-
+
+
+Lemma exec_shrx32_none: forall (rd r1: ireg) (n: int) k (rs: regset) m,
+ Val.shrx rs#r1 (Vint n) = None ->
+ r1 <> X16 ->
+ (IR RA) <> (preg_of_iregsp (RR1 rd)) ->
+ exists rs',
+ exec_straight ge fn (shrx32 rd r1 n k) rs m k rs' m
+ /\ (forall r, data_preg r = true -> r <> rd -> rs'#r = rs#r)
+ /\ rs' # RA = rs # RA.
+Proof.
+ unfold shrx32; intros.
+ destruct (Int.eq n Int.zero) eqn:E.
+- econstructor; split. apply exec_straight_one; [simpl;eauto|auto].
+ split.
+ + intros. Simpl.
+ + Simpl.
+- generalize (Int.eq_spec n Int.one).
+ destruct (Int.eq n Int.one); intro ONE.
+ * subst n.
+ econstructor; split. eapply exec_straight_two.
+ all: cbn; auto.
+ split.
+ ** intros.
+ destruct (Val.add _ _); cbn; Simpl.
+ ** Simpl.
+ * econstructor; split. eapply exec_straight_three.
+ all: cbn; auto.
+ split.
+ ** intros.
+ destruct (Val.shr _ _); cbn; Simpl.
+ ** Simpl.
+Qed.
+
Lemma exec_shrx64: forall (rd r1: ireg) (n: int) k v (rs: regset) m,
Val.shrxl rs#r1 (Vint n) = Some v ->
r1 <> X16 ->
@@ -918,6 +951,38 @@ Proof.
split; intros; Simpl.
Qed.
+Lemma exec_shrx64_none: forall (rd r1: ireg) (n: int) k (rs: regset) m,
+ Val.shrxl rs#r1 (Vint n) = None ->
+ r1 <> X16 ->
+ (IR RA) <> (preg_of_iregsp (RR1 rd)) ->
+ exists rs',
+ exec_straight ge fn (shrx64 rd r1 n k) rs m k rs' m
+ /\ (forall r, data_preg r = true -> r <> rd -> rs'#r = rs#r)
+ /\ rs' # RA = rs # RA.
+Proof.
+ unfold shrx64; intros.
+ destruct (Int.eq n Int.zero) eqn:E.
+- econstructor; split. apply exec_straight_one; [simpl;eauto|auto].
+ split.
+ + intros. Simpl.
+ + Simpl.
+- generalize (Int.eq_spec n Int.one).
+ destruct (Int.eq n Int.one); intro ONE.
+ * subst n.
+ econstructor; split. eapply exec_straight_two.
+ all: cbn; auto.
+ split.
+ ** intros.
+ destruct (Val.addl _ _); cbn; Simpl.
+ ** Simpl.
+ * econstructor; split. eapply exec_straight_three.
+ all: cbn; auto.
+ split.
+ ** intros.
+ destruct (Val.shrl _ _); cbn; Simpl.
+ ** Simpl.
+Qed.
+
(** Condition bits *)
Lemma compare_int_spec: forall rs v1 v2 m,
@@ -1660,10 +1725,19 @@ Local Transparent Val.add.
TranslOpBase.
destruct (eval_shift s (rs x0) a); auto. simpl. rewrite Int.or_zero_l; auto.
- (* shrx *)
- exploit (exec_shrx32 x x0 n); eauto with asmgen. apply (ireg_of_not_RA'' res); eassumption.
+ destruct (Val.shrx (rs x0) (Vint n)) eqn:TOTAL.
+ {
+ exploit (exec_shrx32 x x0 n); eauto with asmgen. apply (ireg_of_not_RA'' res); eassumption.
intros (rs' & A & B & C & D).
econstructor; split. eexact A. split. rewrite B; auto.
split; auto.
+ }
+ exploit (exec_shrx32_none x x0 n); eauto with asmgen. apply (ireg_of_not_RA'' res); eassumption.
+ intros (rs' & A & B & C).
+ econstructor; split. { eexact A. }
+ split. { cbn. constructor. }
+ split; auto.
+
- (* zero-ext *)
TranslOpBase.
destruct (rs x0); auto; simpl. rewrite Int.shl_zero. auto.
@@ -1736,9 +1810,18 @@ Local Transparent Val.add.
TranslOpBase.
destruct (eval_shiftl s (rs x0) a); auto. simpl. rewrite Int64.or_zero_l; auto.
- (* shrx *)
+ destruct (Val.shrxl (rs x0) (Vint n)) eqn:TOTAL.
+ {
exploit (exec_shrx64 x x0 n); eauto with asmgen.
apply (ireg_of_not_RA'' res); eassumption. intros (rs' & A & B & C & D ).
econstructor; split. eexact A. split. rewrite B; auto. auto.
+ }
+ exploit (exec_shrx64_none x x0 n); eauto with asmgen. apply (ireg_of_not_RA'' res); eassumption.
+ intros (rs' & A & B & C).
+ econstructor; split. { eexact A. }
+ split. { cbn. constructor. }
+ split; auto.
+
- (* zero-ext-l *)
TranslOpBase.
destruct (rs x0); auto; simpl. rewrite Int64.shl'_zero. auto.