summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--powerpc/CombineOp.v8
-rw-r--r--powerpc/CombineOpproof.v7
2 files changed, 13 insertions, 2 deletions
diff --git a/powerpc/CombineOp.v b/powerpc/CombineOp.v
index b92e045..5cb7630 100644
--- a/powerpc/CombineOp.v
+++ b/powerpc/CombineOp.v
@@ -101,8 +101,12 @@ Function combine_op (op: operation) (args: list valnum) : option(operation * lis
end
| Oandimm n, x :: nil =>
match get x with
- | Some(Op (Oandimm m) ys) => Some(Oandimm (Int.and m n), ys)
- | Some(Op (Orolm amount m) ys) => Some(Orolm amount (Int.and m n), ys)
+ | Some(Op (Oandimm m) ys) =>
+ Some(let p := Int.and m n in
+ if Int.eq p m then (Omove, x :: nil) else (Oandimm p, ys))
+ | Some(Op (Orolm amount m) ys) =>
+ Some(let p := Int.and m n in
+ if Int.eq p m then (Omove, x :: nil) else (Orolm amount p, ys))
| _ => None
end
| Oorimm n, x :: nil =>
diff --git a/powerpc/CombineOpproof.v b/powerpc/CombineOpproof.v
index 8f4ae19..0e328df 100644
--- a/powerpc/CombineOpproof.v
+++ b/powerpc/CombineOpproof.v
@@ -147,9 +147,16 @@ Transparent Val.sub.
destruct v; simpl; auto. repeat rewrite Int.sub_add_opp. rewrite Int.add_assoc.
rewrite Int.neg_add_distr. decEq. decEq. decEq. apply Int.add_commut.
(* andimm - andimm *)
+ generalize (Int.eq_spec p m0); rewrite H7; intros.
+ exploit get_sound; eauto. unfold equation_holds; simpl; intros. FuncInv.
+ rewrite <- H2. rewrite Val.and_assoc. simpl. fold p. rewrite H0. auto.
exploit get_sound; eauto. unfold equation_holds; simpl; intros. FuncInv.
rewrite <- H1. rewrite Val.and_assoc. auto.
(* andimm - rolm *)
+ generalize (Int.eq_spec p m0); rewrite H7; intros.
+ exploit get_sound; eauto. unfold equation_holds; simpl; intros. FuncInv.
+ rewrite <- H2. destruct v; simpl; auto. unfold Int.rolm.
+ rewrite Int.and_assoc. fold p; rewrite H0. auto.
exploit get_sound; eauto. unfold equation_holds; simpl; intros. FuncInv.
rewrite <- H1. destruct v; simpl; auto. unfold Int.rolm. rewrite Int.and_assoc. auto.
(* orimm *)