summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-10-24 09:55:46 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-10-24 09:55:46 +0000
commit514ea1ae1fc8a2e40c6b45966419c27e1f6aaaa2 (patch)
tree316890c56bb24e2493253629c590a7efab6684f7
parentbf40c619812888bd1505a0c3e12f215090c430c7 (diff)
Fine-tuning of the "andimm" case to generate a move rather than an andimm when possible.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2348 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
-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 *)