summaryrefslogtreecommitdiff
path: root/asmcomp/sparc/emit.mlp
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2014-04-25 08:41:13 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2014-04-25 08:41:13 +0000
commit29b34438e08e26ae8f8623eb32bb524386f0532f (patch)
tree10558f8ec00d86e79fe3ff2f42b189bc7b48929b /asmcomp/sparc/emit.mlp
parent3775a101e664f8c6fdf8bcb60256f021b42613a7 (diff)
downloadocaml-29b34438e08e26ae8f8623eb32bb524386f0532f.tar.gz
- Constant ropagation for float and int32/int64/nativeint arithmetic.
Constant propagation for floats can be turned off with option -no-float-const-prop, for codes that change FP rounding modes at run-time. - Clambda / C-- / Mach: represent float constants as FP numbers of type float rather than literals of type string. - Tested for AMD64; other archs need testing. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14673 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'asmcomp/sparc/emit.mlp')
-rw-r--r--asmcomp/sparc/emit.mlp10
1 files changed, 5 insertions, 5 deletions
diff --git a/asmcomp/sparc/emit.mlp b/asmcomp/sparc/emit.mlp
index 12d60ed327..2793776ff6 100644
--- a/asmcomp/sparc/emit.mlp
+++ b/asmcomp/sparc/emit.mlp
@@ -190,7 +190,7 @@ let emit_frame fd =
(* Record floating-point constants *)
-let float_constants = ref ([] : (int * string) list)
+let float_constants = ref ([] : (int * int64) list)
let emit_float_constant (lbl, cst) =
rodata ();
@@ -309,11 +309,11 @@ let rec emit_instr i dslot =
` sethi %hi({emit_nativeint n}), %g1\n`;
` or %g1, %lo({emit_nativeint n}), {emit_reg i.res.(0)}\n`
end
- | Lop(Iconst_float s) ->
+ | Lop(Iconst_float f) ->
(* On UltraSPARC, the fzero instruction could be used to set a
floating point register pair to zero. *)
let lbl = new_label() in
- float_constants := (lbl, s) :: !float_constants;
+ float_constants := (lbl, Int64.bits_of_float f) :: !float_constants;
` sethi %hi({emit_label lbl}), %g1\n`;
` ldd [%g1 + %lo({emit_label lbl})], {emit_reg i.res.(0)}\n`
| Lop(Iconst_symbol s) ->
@@ -706,9 +706,9 @@ let emit_item = function
| Cint n ->
` .word {emit_nativeint n}\n`
| Csingle f ->
- emit_float32_directive ".word" f
+ emit_float32_directive ".word" (Int32.bits_of_float f)
| Cdouble f ->
- emit_float64_split_directive ".word" f
+ emit_float64_split_directive ".word" (Int64.bits_of_float f)
| Csymbol_address s ->
` .word {emit_symbol s}\n`
| Clabel_address lbl ->