Skip to content

Commit

Permalink
flambda-backend: Move float32 back to beta (ocaml-flambda#2843)
Browse files Browse the repository at this point in the history
* Move float32 back to beta

* Fix `make runtest`

* Fix runtime5 tests
  • Loading branch information
ncik-roberts authored Jul 24, 2024
1 parent 8534452 commit 0889608
Show file tree
Hide file tree
Showing 20 changed files with 245 additions and 221 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions otherlibs/stdlib_beta/amd64/stdlib_beta.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module Float32 = Float32
module Float32_u = Float32_u
2 changes: 2 additions & 0 deletions otherlibs/stdlib_beta/amd64/stdlib_beta.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module Float32 = Float32
module Float32_u = Float32_u
36 changes: 36 additions & 0 deletions otherlibs/stdlib_beta/dune
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,42 @@
(library_flags
(:standard -linkall)))

(rule
(targets
float32.ml
float32.mli
float32_u.ml
float32_u.mli
stdlib_beta.ml
stdlib_beta.mli)
(deps
amd64/float32.ml
amd64/float32.mli
amd64/float32_u.ml
amd64/float32_u.mli
amd64/stdlib_beta.ml
amd64/stdlib_beta.mli)
(enabled_if
(= %{architecture} "amd64"))
(action
(progn
(copy amd64/float32.ml float32.ml)
(copy amd64/float32.mli float32.mli)
(copy amd64/float32_u.ml float32_u.ml)
(copy amd64/float32_u.mli float32_u.mli)
(copy amd64/stdlib_beta.ml stdlib_beta.ml)
(copy amd64/stdlib_beta.mli stdlib_beta.mli))))

(rule
(targets stdlib_beta.ml stdlib_beta.mli)
(deps generic/stdlib_beta.ml generic/stdlib_beta.mli)
(enabled_if
(<> %{architecture} "amd64"))
(action
(progn
(copy generic/stdlib_beta.ml stdlib_beta.ml)
(copy generic/stdlib_beta.mli stdlib_beta.mli))))

(rule
(deps
(:first-dep ../to_install.sh)
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions otherlibs/stdlib_stable/amd64/stdlib_stable.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
module Iarray = Iarray
module IarrayLabels = IarrayLabels
module Float32 = Float32
module Float32_u = Float32_u
2 changes: 0 additions & 2 deletions otherlibs/stdlib_stable/amd64/stdlib_stable.mli
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
module Iarray = Iarray
module IarrayLabels = IarrayLabels
module Float32 = Float32
module Float32_u = Float32_u
12 changes: 0 additions & 12 deletions otherlibs/stdlib_stable/dune
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,15 @@

(rule
(targets
float32.ml
float32.mli
float32_u.ml
float32_u.mli
stdlib_stable.ml
stdlib_stable.mli)
(deps
amd64/float32.ml
amd64/float32.mli
amd64/float32_u.ml
amd64/float32_u.mli
amd64/stdlib_stable.ml
amd64/stdlib_stable.mli)
(enabled_if
(= %{architecture} "amd64"))
(action
(progn
(copy amd64/float32.ml float32.ml)
(copy amd64/float32.mli float32.mli)
(copy amd64/float32_u.ml float32_u.ml)
(copy amd64/float32_u.mli float32_u.mli)
(copy amd64/stdlib_stable.ml stdlib_stable.ml)
(copy amd64/stdlib_stable.mli stdlib_stable.mli))))

Expand Down
4 changes: 2 additions & 2 deletions testsuite/tests/mixed-blocks/closure_padding_float32.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
runtime5;
include stdlib_stable;
include stdlib_beta;
ocamlopt_flags="-extension layouts_alpha -extension small_numbers";
native;
*)
Expand All @@ -10,7 +10,7 @@
https://github.com/ocaml-flambda/flambda-backend/pull/2763
*)

module Float32_u = Stdlib_stable.Float32_u
module Float32_u = Stdlib_beta.Float32_u

type t =
| Mutable_str of { mutable x : string }
Expand Down
6 changes: 3 additions & 3 deletions testsuite/tests/mixed-blocks/constructor_args.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(* TEST
flags = "-extension layouts_beta";
flambda2;
include stdlib_stable;
include stdlib_beta;
include stdlib_upstream_compatible;
{
native;
Expand All @@ -13,8 +13,8 @@
(*****************************************)
(* Prelude: Functions on unboxed numbers *)

module Float32_u = Stdlib_stable.Float32_u
module Float32 = Stdlib_stable.Float32
module Float32_u = Stdlib_beta.Float32_u
module Float32 = Stdlib_beta.Float32
module Float_u = Stdlib_upstream_compatible.Float_u
module Int32_u = Stdlib_upstream_compatible.Int32_u
module Int64_u = Stdlib_upstream_compatible.Int64_u
Expand Down
10 changes: 5 additions & 5 deletions testsuite/tests/mixed-blocks/generate_mixed_blocks_code.ml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ let type_to_field_integrity_check type_ ~access1 ~access2 ~message =
| Imm -> "check_int", None
| Float -> "check_float", None
| Float64 -> "check_float", Some "Stdlib_upstream_compatible.Float_u.to_float"
| Float32 -> "check_float32", Some "Stdlib_stable.Float32_u.to_float32"
| Float32 -> "check_float32", Some "Stdlib_beta.Float32_u.to_float32"
| Bits32 -> "check_int32", Some "Stdlib_upstream_compatible.Int32_u.to_int32"
| Bits64 -> "check_int64", Some "Stdlib_upstream_compatible.Int64_u.to_int64"
| Word -> "check_int", Some "Stdlib_upstream_compatible.Nativeint_u.to_int"
Expand Down Expand Up @@ -613,7 +613,7 @@ let main n ~bytecode =
in
line {|(* TEST
flags = "-extension layouts_beta";
include stdlib_stable;
include stdlib_beta;
include stdlib_upstream_compatible;|};
if bytecode then (
line {| bytecode;|};
Expand All @@ -628,9 +628,9 @@ let main n ~bytecode =
line {|let create_string () = String.make (Random.int 100) 'a'|};
line {|let create_int () = Random.int 0x3FFF_FFFF|};
line {|let create_float () = Random.float Float.max_float|};
line {|let create_float32 () = Stdlib_stable.Float32.of_float (Random.float Float.max_float)|};
line {|let create_float32 () = Stdlib_beta.Float32.of_float (Random.float Float.max_float)|};
line {|let create_float_u () = Stdlib_upstream_compatible.Float_u.of_float (create_float ())|};
line {|let create_float32_u () = Stdlib_stable.Float32_u.of_float32 (create_float32 ())|};
line {|let create_float32_u () = Stdlib_beta.Float32_u.of_float32 (create_float32 ())|};
line {|let create_int32_u () = Stdlib_upstream_compatible.Int32_u.of_int32 (Random.int32 0x7FFF_FFFFl)|};
line {|let create_int64_u () = Stdlib_upstream_compatible.Int64_u.of_int64 (Random.int64 0x7FFF_FFFF_FFFF_FFFFL)|};
line {|let create_nativeint_u () = Stdlib_upstream_compatible.Nativeint_u.of_nativeint (Random.nativeint 0x7FFF_FFFF_FFFF_FFFFn)|};
Expand All @@ -648,7 +648,7 @@ let main n ~bytecode =
check_gen ~equal:Float.equal ~to_string:Float.to_string|};
line
{|let check_float32 =
check_gen ~equal:Stdlib_stable.Float32.equal ~to_string:Stdlib_stable.Float32.to_string|};
check_gen ~equal:Stdlib_beta.Float32.equal ~to_string:Stdlib_beta.Float32.to_string|};
line
{|let check_int32 =
check_gen ~equal:Int32.equal ~to_string:Int32.to_string|};
Expand Down
Loading

0 comments on commit 0889608

Please sign in to comment.