aboutsummaryrefslogtreecommitdiffstats
path: root/mppa_k1c/Asmblockdeps.v
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-03-19 22:13:53 +0100
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-03-19 22:13:53 +0100
commit4cc5324db73dd014bcd2c118f5769f88e52f8643 (patch)
tree6f3df7b011f34f2cdaa8381342756708f7b02e49 /mppa_k1c/Asmblockdeps.v
parentf321f75979d18ab99f226b2c5d6bbb59bffb5cac (diff)
parent2af07d6a328f73a32bc2c768e3108dd3db393ed1 (diff)
downloadcompcert-kvx-4cc5324db73dd014bcd2c118f5769f88e52f8643.tar.gz
compcert-kvx-4cc5324db73dd014bcd2c118f5769f88e52f8643.zip
Merge branch 'mppa-madd' into mppa_postpass
Diffstat (limited to 'mppa_k1c/Asmblockdeps.v')
-rw-r--r--mppa_k1c/Asmblockdeps.v97
1 files changed, 82 insertions, 15 deletions
diff --git a/mppa_k1c/Asmblockdeps.v b/mppa_k1c/Asmblockdeps.v
index 7e9fb8f1..501ec212 100644
--- a/mppa_k1c/Asmblockdeps.v
+++ b/mppa_k1c/Asmblockdeps.v
@@ -54,6 +54,9 @@ Inductive arith_op :=
| OArithRRR (n: arith_name_rrr)
| OArithRRI32 (n: arith_name_rri32) (imm: int)
| OArithRRI64 (n: arith_name_rri64) (imm: int64)
+ | OArithARRR (n: arith_name_arrr)
+ | OArithARRI32 (n: arith_name_arri32) (imm: int)
+ | OArithARRI64 (n: arith_name_arri64) (imm: int64)
.
Coercion OArithR: arith_name_r >-> arith_op.
@@ -111,10 +114,13 @@ Definition arith_eval (ao: arith_op) (l: list value) :=
| OArithRF64 n i, [] => Some (Val (arith_eval_rf64 n i))
| OArithRRR n, [Val v1; Val v2] => Some (Val (arith_eval_rrr n v1 v2))
-
| OArithRRI32 n i, [Val v] => Some (Val (arith_eval_rri32 n v i))
| OArithRRI64 n i, [Val v] => Some (Val (arith_eval_rri64 n v i))
+ | OArithARRR n, [Val v1; Val v2; Val v3] => Some (Val (arith_eval_arrr n v1 v2 v3))
+ | OArithARRI32 n i, [Val v1; Val v2] => Some (Val (arith_eval_arri32 n v1 v2 i))
+ | OArithARRI64 n i, [Val v1; Val v2] => Some (Val (arith_eval_arri64 n v1 v2 i))
+
| _, _ => None
end.
@@ -282,17 +288,31 @@ Definition iandb (ib1 ib2: ?? bool): ?? bool :=
RET (andb b1 b2).
Definition arith_op_eq (o1 o2: arith_op): ?? bool :=
- match o1, o2 with
- | OArithR n1, OArithR n2 => struct_eq n1 n2
- | OArithRR n1, OArithRR n2 => phys_eq n1 n2
- | OArithRI32 n1 i1, OArithRI32 n2 i2 => iandb (phys_eq n1 n2) (phys_eq i1 i2)
- | OArithRI64 n1 i1, OArithRI64 n2 i2 => iandb (phys_eq n1 n2) (phys_eq i1 i2)
- | OArithRF32 n1 i1, OArithRF32 n2 i2 => iandb (phys_eq n1 n2) (phys_eq i1 i2)
- | OArithRF64 n1 i1, OArithRF64 n2 i2 => iandb (phys_eq n1 n2) (phys_eq i1 i2)
- | OArithRRR n1, OArithRRR n2 => phys_eq n1 n2
- | OArithRRI32 n1 i1, OArithRRI32 n2 i2 => iandb (phys_eq n1 n2) (phys_eq i1 i2)
- | OArithRRI64 n1 i1, OArithRRI64 n2 i2 => iandb (phys_eq n1 n2) (phys_eq i1 i2)
- | _, _ => RET false
+ match o1 with
+ | OArithR n1 =>
+ match o2 with OArithR n2 => struct_eq n1 n2 | _ => RET false end
+ | OArithRR n1 =>
+ match o2 with OArithRR n2 => phys_eq n1 n2 | _ => RET false end
+ | OArithRI32 n1 i1 =>
+ match o2 with OArithRI32 n2 i2 => iandb (phys_eq n1 n2) (phys_eq i1 i2) | _ => RET false end
+ | OArithRI64 n1 i1 =>
+ match o2 with OArithRI64 n2 i2 => iandb (phys_eq n1 n2) (phys_eq i1 i2) | _ => RET false end
+ | OArithRF32 n1 i1 =>
+ match o2 with OArithRF32 n2 i2 => iandb (phys_eq n1 n2) (phys_eq i1 i2) | _ => RET false end
+ | OArithRF64 n1 i1 =>
+ match o2 with OArithRF64 n2 i2 => iandb (phys_eq n1 n2) (phys_eq i1 i2) | _ => RET false end
+ | OArithRRR n1 =>
+ match o2 with OArithRRR n2 => phys_eq n1 n2 | _ => RET false end
+ | OArithRRI32 n1 i1 =>
+ match o2 with OArithRRI32 n2 i2 => iandb (phys_eq n1 n2) (phys_eq i1 i2) | _ => RET false end
+ | OArithRRI64 n1 i1 =>
+ match o2 with OArithRRI64 n2 i2 => iandb (phys_eq n1 n2) (phys_eq i1 i2) | _ => RET false end
+ | OArithARRR n1 =>
+ match o2 with OArithARRR n2 => phys_eq n1 n2 | _ => RET false end
+ | OArithARRI32 n1 i1 =>
+ match o2 with OArithARRI32 n2 i2 => iandb (phys_eq n1 n2) (phys_eq i1 i2) | _ => RET false end
+ | OArithARRI64 n1 i1 =>
+ match o2 with OArithARRI64 n2 i2 => iandb (phys_eq n1 n2) (phys_eq i1 i2) | _ => RET false end
end.
Lemma arith_op_eq_correct o1 o2:
@@ -329,7 +349,8 @@ Proof.
apply andb_prop in H1; inversion H1; apply H in H2; apply H0 in H3; congruence.
Qed.
-
+(* TODO: rewrite control_op_eq in a robust style against the miss of a case
+ cf. arith_op_eq above *)
Definition control_op_eq (c1 c2: control_op): ?? bool :=
match c1, c2 with
| Oj_l l1, Oj_l l2 => phys_eq l1 l2
@@ -353,6 +374,8 @@ Proof.
Qed.
+(* TODO: rewrite op_eq in a robust style against the miss of a case
+ cf. arith_op_eq above *)
Definition op_eq (o1 o2: op): ?? bool :=
match o1, o2 with
| Arith i1, Arith i2 => arith_op_eq i1 i2
@@ -389,13 +412,12 @@ Qed.
(* Definition op_eq (o1 o2: op): ?? bool := struct_eq o1 o2.
-
Theorem op_eq_correct o1 o2:
WHEN op_eq o1 o2 ~> b THEN b=true -> o1 = o2.
Proof.
wlp_simplify.
Qed.
- *)
+*)
End IMPPARAM.
@@ -541,6 +563,9 @@ Definition trans_arith (ai: ar_instruction) : macro :=
| PArithRRR n d s1 s2 => [(#d, Op (Arith (OArithRRR n)) (Name (#s1) @ Name (#s2) @ Enil))]
| PArithRRI32 n d s i => [(#d, Op (Arith (OArithRRI32 n i)) (Name (#s) @ Enil))]
| PArithRRI64 n d s i => [(#d, Op (Arith (OArithRRI64 n i)) (Name (#s) @ Enil))]
+ | PArithARRR n d s1 s2 => [(#d, Op (Arith (OArithARRR n)) (Name(#d) @ Name (#s1) @ Name (#s2) @ Enil))]
+ | PArithARRI32 n d s i => [(#d, Op (Arith (OArithARRI32 n i)) (Name(#d) @ Name (#s) @ Enil))]
+ | PArithARRI64 n d s i => [(#d, Op (Arith (OArithARRI64 n i)) (Name(#d) @ Name (#s) @ Enil))]
end.
@@ -727,6 +752,27 @@ Proof.
* Simpl.
* intros rr; destruct rr; Simpl.
destruct (ireg_eq g rd); subst; Simpl.
+(* PArithARRR *)
+ - inv H; inv H0;
+ eexists; split; try split.
+ * simpl. pose (H1 rd); rewrite e. pose (H1 rs1); rewrite e0. pose (H1 rs2); rewrite e1. reflexivity.
+ * Simpl.
+ * intros rr; destruct rr; Simpl.
+ destruct (ireg_eq g rd); subst; Simpl.
+(* PArithARRI32 *)
+ - inv H; inv H0;
+ eexists; split; try split.
+ * simpl. pose (H1 rd); rewrite e. pose (H1 rs0); rewrite e0. reflexivity.
+ * Simpl.
+ * intros rr; destruct rr; Simpl.
+ destruct (ireg_eq g rd); subst; Simpl.
+(* PArithARRI64 *)
+ - inv H; inv H0;
+ eexists; split; try split.
+ * simpl. pose (H1 rd); rewrite e. pose (H1 rs0); rewrite e0. reflexivity.
+ * Simpl.
+ * intros rr; destruct rr; Simpl.
+ destruct (ireg_eq g rd); subst; Simpl.
Qed.
Lemma forward_simu_basic:
@@ -1379,6 +1425,7 @@ Definition string_of_name_rri32 (n: arith_name_rri32): pstring :=
match n with
Pcompiw _ => "Pcompiw"
| Paddiw => "Paddiw"
+ | Pmuliw => "Pmuliw"
| Pandiw => "Pandiw"
| Pnandiw => "Pnandiw"
| Poriw => "Poriw"
@@ -1400,6 +1447,7 @@ Definition string_of_name_rri64 (n: arith_name_rri64): pstring :=
match n with
Pcompil _ => "Pcompil"
| Paddil => "Paddil"
+ | Pmulil => "Pmulil"
| Pandil => "Pandil"
| Pnandil => "Pnandil"
| Poril => "Poril"
@@ -1410,6 +1458,22 @@ Definition string_of_name_rri64 (n: arith_name_rri64): pstring :=
| Pornil => "Pornil"
end.
+Definition string_of_name_arrr (n: arith_name_arrr): pstring :=
+ match n with
+ | Pmaddw => "Pmaddw"
+ | Pmaddl => "Pmaddl"
+ end.
+
+Definition string_of_name_arri32 (n: arith_name_arri32): pstring :=
+ match n with
+ | Pmaddiw => "Pmaddw"
+ end.
+
+Definition string_of_name_arri64 (n: arith_name_arri64): pstring :=
+ match n with
+ | Pmaddil => "Pmaddl"
+ end.
+
Definition string_of_arith (op: arith_op): pstring :=
match op with
| OArithR n => string_of_name_r n
@@ -1421,6 +1485,9 @@ Definition string_of_arith (op: arith_op): pstring :=
| OArithRRR n => string_of_name_rrr n
| OArithRRI32 n _ => string_of_name_rri32 n
| OArithRRI64 n _ => string_of_name_rri64 n
+ | OArithARRR n => string_of_name_arrr n
+ | OArithARRI32 n _ => string_of_name_arri32 n
+ | OArithARRI64 n _ => string_of_name_arri64 n
end.
Definition string_of_name_lrro (n: load_name_rro) : pstring :=