summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-06-28 07:59:03 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-06-28 07:59:03 +0000
commit5312915c1b29929f82e1f8de80609a277584913f (patch)
tree0f7ee475743f0eb05d352148a9e1f0b861ee9d34 /backend
parentf3250c32ff42ae18fd03a5311c1f0caec3415aba (diff)
Use Flocq for floats
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1939 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'backend')
-rw-r--r--backend/CMparser.mly10
-rw-r--r--backend/CMtypecheck.ml2
-rw-r--r--backend/PrintCminor.ml6
3 files changed, 9 insertions, 9 deletions
diff --git a/backend/CMparser.mly b/backend/CMparser.mly
index 37b6144..4a91a01 100644
--- a/backend/CMparser.mly
+++ b/backend/CMparser.mly
@@ -368,10 +368,10 @@ init_data:
| INT32 INTLIT { Init_int32 (coqint_of_camlint $2) }
| INT INTLIT { Init_int32 (coqint_of_camlint $2) }
| INTLIT { Init_int32 (coqint_of_camlint $1) }
- | FLOAT32 FLOATLIT { Init_float32 ($2) }
- | FLOAT64 FLOATLIT { Init_float64 ($2) }
- | FLOAT FLOATLIT { Init_float64 ($2) }
- | FLOATLIT { Init_float64 ($1) }
+ | FLOAT32 FLOATLIT { Init_float32 (coqfloat_of_camlfloat $2) }
+ | FLOAT64 FLOATLIT { Init_float64 (coqfloat_of_camlfloat $2) }
+ | FLOAT FLOATLIT { Init_float64 (coqfloat_of_camlfloat $2) }
+ | FLOATLIT { Init_float64 (coqfloat_of_camlfloat $1) }
| LBRACKET INTLIT RBRACKET { Init_space (z_of_camlint $2) }
| INTLIT LPAREN STRINGLIT RPAREN { Init_addrof ($3, coqint_of_camlint $1) }
;
@@ -491,7 +491,7 @@ expr:
LPAREN expr RPAREN { $2 }
| IDENT { Rvar $1 }
| INTLIT { intconst $1 }
- | FLOATLIT { Rconst(Ofloatconst $1) }
+ | FLOATLIT { Rconst(Ofloatconst (coqfloat_of_camlfloat $1)) }
| STRINGLIT { Rconst(Oaddrsymbol($1, Int.zero)) }
| AMPERSAND INTLIT { Rconst(Oaddrstack(coqint_of_camlint $2)) }
| MINUS expr %prec p_uminus { Runop(Onegint, $2) }
diff --git a/backend/CMtypecheck.ml b/backend/CMtypecheck.ml
index 244a73f..8db488a 100644
--- a/backend/CMtypecheck.ml
+++ b/backend/CMtypecheck.ml
@@ -125,7 +125,7 @@ let type_binary_operation = function
let name_of_constant = function
| Ointconst n -> sprintf "intconst %ld" (camlint_of_coqint n)
- | Ofloatconst n -> sprintf "floatconst %g" n
+ | Ofloatconst n -> sprintf "floatconst %g" (camlfloat_of_coqfloat n)
| Oaddrsymbol (s, ofs) -> sprintf "addrsymbol %s %ld" (extern_atom s) (camlint_of_coqint ofs)
| Oaddrstack n -> sprintf "addrstack %ld" (camlint_of_coqint n)
diff --git a/backend/PrintCminor.ml b/backend/PrintCminor.ml
index f355760..cdbd870 100644
--- a/backend/PrintCminor.ml
+++ b/backend/PrintCminor.ml
@@ -125,7 +125,7 @@ let rec expr p (prec, e) =
| Econst(Ointconst n) ->
fprintf p "%ld" (camlint_of_coqint n)
| Econst(Ofloatconst f) ->
- fprintf p "%F" f
+ fprintf p "%F" (camlfloat_of_coqfloat f)
| Econst(Oaddrsymbol(id, ofs)) ->
let ofs = camlint_of_coqint ofs in
if ofs = 0l
@@ -288,8 +288,8 @@ let print_init_data p = function
| Init_int8 i -> fprintf p "int8 %ld" (camlint_of_coqint i)
| Init_int16 i -> fprintf p "int16 %ld" (camlint_of_coqint i)
| Init_int32 i -> fprintf p "%ld" (camlint_of_coqint i)
- | Init_float32 f -> fprintf p "float32 %F" f
- | Init_float64 f -> fprintf p "%F" f
+ | Init_float32 f -> fprintf p "float32 %F" (camlfloat_of_coqfloat f)
+ | Init_float64 f -> fprintf p "%F" (camlfloat_of_coqfloat f)
| Init_space i -> fprintf p "[%ld]" (camlint_of_coqint i)
| Init_addrof(id,off) -> fprintf p "%ld(\"%s\")" (camlint_of_coqint off) (extern_atom id)