aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-05-11 22:40:50 +0200
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-05-11 22:40:50 +0200
commit005093b87250b6b27b320eb789574da4bda616c0 (patch)
tree0adf1198f5b741d1da61523a5278fb90af18d9f7
parent66ee59d3dc8a861b468cfaf0ff46fc71dfb8fec2 (diff)
downloadcompcert-kvx-005093b87250b6b27b320eb789574da4bda616c0.tar.gz
compcert-kvx-005093b87250b6b27b320eb789574da4bda616c0.zip
correct -faddx option and propagate addim over addxim
-rw-r--r--mppa_k1c/SelectLong.vp7
-rw-r--r--mppa_k1c/SelectLongproof.v5
-rw-r--r--mppa_k1c/SelectOp.vp14
-rw-r--r--mppa_k1c/SelectOpproof.v5
4 files changed, 21 insertions, 10 deletions
diff --git a/mppa_k1c/SelectLong.vp b/mppa_k1c/SelectLong.vp
index 2450ab97..4e369e11 100644
--- a/mppa_k1c/SelectLong.vp
+++ b/mppa_k1c/SelectLong.vp
@@ -67,7 +67,7 @@ Definition longofintu (e: expr) :=
(** ** Integer addition and pointer addition *)
Definition addlimm_shllimm sh k2 e1 :=
- if Compopts.optim_faddx tt
+ if Compopts.optim_addx tt
then
match shift1_4_of_z (Int.unsigned sh) with
| Some s14 => Eop (Oaddxlimm s14 k2) (e1:::Enil)
@@ -80,17 +80,18 @@ Nondetfunction addlimm (n: int64) (e: expr) :=
match e with
| Eop (Olongconst m) Enil => longconst (Int64.add n m)
| Eop (Oaddrsymbol s m) Enil =>
- (if Compopts.optim_fglobaladdroffset tt
+ (if Compopts.optim_globaladdroffset tt
then Eop (Oaddrsymbol s (Ptrofs.add (Ptrofs.of_int64 n) m)) Enil
else Eop (Oaddlimm n) (e ::: Enil))
| Eop (Oaddrstack m) Enil => Eop (Oaddrstack (Ptrofs.add (Ptrofs.of_int64 n) m)) Enil
| Eop (Oaddlimm m) (t ::: Enil) => Eop (Oaddlimm(Int64.add n m)) (t ::: Enil)
+ | Eop (Oaddxlimm sh m) (t ::: Enil) => Eop (Oaddxlimm sh (Int64.add n m)) (t ::: Enil)
| Eop (Oshllimm sh) (t1:::Enil) => addlimm_shllimm sh n t1
| _ => Eop (Oaddlimm n) (e ::: Enil)
end.
Definition addl_shllimm n e1 e2 :=
- if Compopts.optim_faddx tt
+ if Compopts.optim_addx tt
then
match shift1_4_of_z (Int.unsigned n) with
| Some s14 => Eop (Oaddxl s14) (e1:::e2:::Enil)
diff --git a/mppa_k1c/SelectLongproof.v b/mppa_k1c/SelectLongproof.v
index 58a4c39a..78a2bb31 100644
--- a/mppa_k1c/SelectLongproof.v
+++ b/mppa_k1c/SelectLongproof.v
@@ -206,6 +206,11 @@ Proof.
destruct sp; simpl; auto. destruct Archi.ptr64; auto.
rewrite Ptrofs.add_assoc, (Ptrofs.add_commut m0). auto.
- subst x. rewrite Val.addl_assoc. rewrite Int64.add_commut. TrivialExists.
+- TrivialExists; simpl. subst x.
+ destruct v1; simpl; trivial.
+ destruct (Int.ltu _ _); simpl; trivial.
+ rewrite Int64.add_assoc. rewrite Int64.add_commut.
+ reflexivity.
- pose proof eval_addlimm_shllimm as ADDXL.
unfold unary_constructor_sound in ADDXL.
unfold addxl in ADDXL.
diff --git a/mppa_k1c/SelectOp.vp b/mppa_k1c/SelectOp.vp
index 4d2a948d..7cf300f8 100644
--- a/mppa_k1c/SelectOp.vp
+++ b/mppa_k1c/SelectOp.vp
@@ -105,7 +105,7 @@ Definition addrstack (ofs: ptrofs) :=
(** ** Integer addition and pointer addition *)
Definition addimm_shlimm sh k2 e1 :=
- if Compopts.optim_faddx tt
+ if Compopts.optim_addx tt
then
match shift1_4_of_z (Int.unsigned sh) with
| Some s14 => Eop (Oaddximm s14 k2) (e1:::Enil)
@@ -120,13 +120,13 @@ Nondetfunction addimm (n: int) (e: expr) :=
| Eop (Oaddrsymbol s m) Enil => Eop (Oaddrsymbol s (Ptrofs.add (Ptrofs.of_int n) m)) Enil
| Eop (Oaddrstack m) Enil => Eop (Oaddrstack (Ptrofs.add (Ptrofs.of_int n) m)) Enil
| Eop (Oaddimm m) (t ::: Enil) => Eop (Oaddimm(Int.add n m)) (t ::: Enil)
- | Eop (Oshlimm sh) (t1:::Enil) =>
- addimm_shlimm sh n t1
+ | Eop (Oaddximm sh m) (t ::: Enil) => Eop (Oaddximm sh (Int.add n m)) (t ::: Enil)
+ | Eop (Oshlimm sh) (t1:::Enil) => addimm_shlimm sh n t1
| _ => Eop (Oaddimm n) (e ::: Enil)
end.
Definition add_shlimm n e1 e2 :=
- if Compopts.optim_faddx tt
+ if Compopts.optim_addx tt
then
match shift1_4_of_z (Int.unsigned n) with
| Some s14 => Eop (Oaddx s14) (e1:::e2:::Enil)
@@ -612,13 +612,13 @@ Nondetfunction addressing (chunk: memory_chunk) (e: expr) :=
match e with
| Eop (Oaddrstack n) Enil => (Ainstack n, Enil)
| Eop (Oaddrsymbol id ofs) Enil =>
- (if (orb (Archi.pic_code tt) (negb (Compopts.optim_fglobaladdrtmp tt)))
+ (if (orb (Archi.pic_code tt) (negb (Compopts.optim_globaladdrtmp tt)))
then (Aindexed Ptrofs.zero, e:::Enil)
else (Aglobal id ofs, Enil))
| Eop (Oaddimm n) (e1:::Enil) => (Aindexed (Ptrofs.of_int n), e1:::Enil)
| Eop (Oaddlimm n) (e1:::Enil) => (Aindexed (Ptrofs.of_int64 n), e1:::Enil)
| Eop Oaddl (e1:::(Eop (Oshllimm scale) (e2:::Enil)):::Enil) =>
- (if Compopts.optim_fxsaddr tt
+ (if Compopts.optim_xsaddr tt
then let zscale := Int.unsigned scale in
if Z.eq_dec zscale (zscale_of_chunk chunk)
then (Aindexed2XS zscale, e1:::e2:::Enil)
@@ -627,7 +627,7 @@ Nondetfunction addressing (chunk: memory_chunk) (e: expr) :=
| Eop (Oaddxl sh) (e1:::e2:::Enil) =>
let zscale := ExtValues.z_of_shift1_4 sh in
let scale := Int.repr zscale in
- (if Compopts.optim_fxsaddr tt
+ (if Compopts.optim_xsaddr tt
then if Z.eq_dec zscale (zscale_of_chunk chunk)
then (Aindexed2XS zscale, e2:::e1:::Enil)
else (Aindexed2, e2:::(Eop (Oshllimm scale) (e1:::Enil)):::Enil)
diff --git a/mppa_k1c/SelectOpproof.v b/mppa_k1c/SelectOpproof.v
index f5a90803..ad7e4209 100644
--- a/mppa_k1c/SelectOpproof.v
+++ b/mppa_k1c/SelectOpproof.v
@@ -267,6 +267,11 @@ Proof.
+ econstructor; split. EvalOp. simpl; eauto.
destruct sp; simpl; auto.
+ TrivialExists; simpl. subst x. rewrite Val.add_assoc. rewrite Int.add_commut. auto.
+ + TrivialExists; simpl. subst x.
+ destruct v1; simpl; trivial.
+ destruct (Int.ltu _ _); simpl; trivial.
+ rewrite Int.add_assoc. rewrite Int.add_commut.
+ reflexivity.
+ pose proof eval_addimm_shlimm as ADDX.
unfold unary_constructor_sound in ADDX.
unfold addx in ADDX.