diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2013-09-14 16:24:30 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2013-09-14 16:24:30 +0000 |
commit | 76ea1108be6f8b4ba9dc0118a13f685bcb62bc2b (patch) | |
tree | 8b2dad961e6b368426573e8a217594b9bcb42752 /ia32/SelectOp.vp | |
parent | 9a0ff6bb768cb0a6e45c1c75727d1cd8199cb89e (diff) | |
download | compcert-kvx-76ea1108be6f8b4ba9dc0118a13f685bcb62bc2b.tar.gz compcert-kvx-76ea1108be6f8b4ba9dc0118a13f685bcb62bc2b.zip |
Floats.v, Nan.v: hard-wire the general shape of binop_pl, so that no axioms
are necessary, only two parameters (default_pl and choose_binop_pl).
SelectDiv: optimize FP division by a power of 2.
ConstpropOp: optimize 2.0 * x and x * 2.0 into x + x.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2326 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'ia32/SelectOp.vp')
-rw-r--r-- | ia32/SelectOp.vp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ia32/SelectOp.vp b/ia32/SelectOp.vp index 209147e3..1471405e 100644 --- a/ia32/SelectOp.vp +++ b/ia32/SelectOp.vp @@ -334,7 +334,18 @@ Definition absf (e: expr) := Eop Oabsf (e ::: Enil). Definition addf (e1 e2: expr) := Eop Oaddf (e1 ::: e2 ::: Enil). Definition subf (e1 e2: expr) := Eop Osubf (e1 ::: e2 ::: Enil). Definition mulf (e1 e2: expr) := Eop Omulf (e1 ::: e2 ::: Enil). -Definition divf (e1 e2: expr) := Eop Odivf (e1 ::: e2 ::: Enil). + +Definition divfimm (e: expr) (n: float) := + match Float.exact_inverse n with + | Some n' => Eop Omulf (e ::: Eop (Ofloatconst n') Enil ::: Enil) + | None => Eop Odivf (e ::: Eop (Ofloatconst n) Enil ::: Enil) + end. + +Nondetfunction divf (e1: expr) (e2: expr) := + match e2 with + | Eop (Ofloatconst n2) Enil => divfimm e1 n2 + | _ => Eop Odivf (e1 ::: e2 ::: Enil) + end. (** ** Comparisons *) |