@@ -137,6 +137,9 @@ let get_field env mut layout ptr n dbg =
137
137
| Pvalue Pintval | Punboxed_int _ -> Word_int
138
138
| Pvalue _ -> Word_val
139
139
| Punboxed_float Pfloat64 -> Double
140
+ | Punboxed_float Pfloat32 ->
141
+ Misc. fatal_error
142
+ " float32 is not supported in the upstream compiler build."
140
143
| Punboxed_vector _ ->
141
144
Misc. fatal_error
142
145
" SIMD vectors are not supported in the upstream compiler build."
@@ -657,10 +660,10 @@ let rec transl env e =
657
660
| Patomic_cas | Patomic_fetch_add
658
661
| Psequor | Pnot | Pnegint | Paddint | Psubint
659
662
| Pmulint | Pandint | Porint | Pxorint | Plslint
660
- | Plsrint | Pasrint | Pintoffloat Pfloat64 | Pfloatofint (Pfloat64 , _)
661
- | Pnegfloat (Pfloat64 , _) | Pabsfloat (Pfloat64 , _)
662
- | Paddfloat (Pfloat64 , _) | Psubfloat (Pfloat64 , _)
663
- | Pmulfloat (Pfloat64 , _) | Pdivfloat (Pfloat64 , _)
663
+ | Plsrint | Pasrint | Pintoffloat _ | Pfloatofint (_ , _)
664
+ | Pnegfloat (_ , _) | Pabsfloat (_ , _)
665
+ | Paddfloat (_ , _) | Psubfloat (_ , _)
666
+ | Pmulfloat (_ , _) | Pdivfloat (_ , _)
664
667
| Pstringlength | Pstringrefu
665
668
| Pstringrefs | Pbyteslength | Pbytesrefu | Pbytessetu
666
669
| Pbytesrefs | Pbytessets | Pisint | Pisout
@@ -669,15 +672,15 @@ let rec transl env e =
669
672
| Pfloatfield _ | Psetfloatfield (_, _) | Pduprecord (_, _)
670
673
| Pufloatfield _ | Psetufloatfield (_, _)
671
674
| Praise _ | Pdivint _ | Pmodint _ | Pintcomp _ | Poffsetint _
672
- | Pcompare_ints | Pcompare_floats Pfloat64 | Pcompare_bints _
673
- | Poffsetref _ | Pfloatcomp (Pfloat64 , _) | Punboxed_float_comp (Pfloat64 , _)
675
+ | Pcompare_ints | Pcompare_floats _ | Pcompare_bints _
676
+ | Poffsetref _ | Pfloatcomp (_ , _) | Punboxed_float_comp (_ , _)
674
677
| Parraylength _ | Parrayrefu _ | Parraysetu _ | Parrayrefs _ | Parraysets _
675
678
| Pbintofint _ | Pintofbint _ | Pcvtbint _ | Pnegbint _
676
679
| Paddbint _ | Psubbint _ | Pmulbint _ | Pdivbint _ | Pmodbint _
677
680
| Pandbint _ | Porbint _ | Pxorbint _ | Plslbint _ | Plsrbint _
678
681
| Pasrbint _ | Pbintcomp (_, _) | Punboxed_int_comp (_, _) | Pstring_load _
679
682
| Pbytes_load _ | Pbytes_set _ | Pbigstring_load _ | Pbigstring_set _
680
- | Punbox_float Pfloat64 | Pbox_float (Pfloat64 , _) | Punbox_int _ | Pbox_int _
683
+ | Punbox_float _ | Pbox_float (_ , _) | Punbox_int _ | Pbox_int _
681
684
| Pbbswap _ | Pget_header _), _)
682
685
->
683
686
fatal_error " Cmmgen.transl:prim"
@@ -876,7 +879,7 @@ and transl_make_array dbg env kind mode args =
876
879
| Pfloatarray ->
877
880
make_float_alloc ~mode dbg Obj. double_array_tag
878
881
(List. map (transl_unbox_float dbg env) args)
879
- | Punboxedfloatarray Pfloat64 | Punboxedintarray _ ->
882
+ | Punboxedfloatarray _ | Punboxedintarray _ ->
880
883
Misc. fatal_errorf " Unboxed arrays not supported"
881
884
882
885
and transl_ccall env prim args dbg =
@@ -885,6 +888,9 @@ and transl_ccall env prim args dbg =
885
888
| Same_as_ocaml_repr sort -> (exttype_of_sort sort, transl env arg)
886
889
| Unboxed_float Pfloat64 ->
887
890
(XFloat , transl_unbox_float dbg env arg)
891
+ | Unboxed_float Pfloat32 ->
892
+ Misc. fatal_error
893
+ " float32 is not supported in the upstream compiler build."
888
894
| Unboxed_integer bi ->
889
895
let xty =
890
896
match bi with
@@ -916,6 +922,9 @@ and transl_ccall env prim args dbg =
916
922
| _ , Same_as_ocaml_repr sort -> (machtype_of_sort sort, fun x -> x)
917
923
(* TODO: Allow Alloc_local on suitably typed C stubs *)
918
924
| _ , Unboxed_float Pfloat64 -> (typ_float, box_float dbg alloc_heap)
925
+ | _ , Unboxed_float Pfloat32 ->
926
+ Misc. fatal_error
927
+ " float32 is not supported in the upstream compiler build."
919
928
| _ , Unboxed_integer bi -> (typ_int, box_int dbg bi alloc_heap)
920
929
| _ , Untagged_int -> (typ_int, (fun i -> tag_int i dbg))
921
930
| _ , Unboxed_vector _ ->
@@ -969,6 +978,13 @@ and transl_prim_1 env p arg dbg =
969
978
box_float dbg m (Cop (Cnegf , [transl_unbox_float dbg env arg], dbg))
970
979
| Pabsfloat (Pfloat64, m ) ->
971
980
box_float dbg m (Cop (Cabsf , [transl_unbox_float dbg env arg], dbg))
981
+ | Punbox_float Pfloat32
982
+ | Pbox_float (Pfloat32 , _)
983
+ | Pfloatofint (Pfloat32 , _)
984
+ | Pintoffloat Pfloat32
985
+ | Pnegfloat (Pfloat32 , _)
986
+ | Pabsfloat (Pfloat32, _ ) ->
987
+ Misc. fatal_error " float32 is not supported in the upstream compiler build."
972
988
(* String operations *)
973
989
| Pstringlength | Pbyteslength ->
974
990
tag_int(string_length (transl env arg) dbg) dbg
@@ -1025,16 +1041,16 @@ and transl_prim_1 env p arg dbg =
1025
1041
| Patomic_exchange | Patomic_cas | Patomic_fetch_add
1026
1042
| Paddint | Psubint | Pmulint | Pandint
1027
1043
| Porint | Pxorint | Plslint | Plsrint | Pasrint
1028
- | Paddfloat (Pfloat64 , _) | Psubfloat (Pfloat64 , _)
1029
- | Pmulfloat (Pfloat64 , _) | Pdivfloat (Pfloat64 , _)
1044
+ | Paddfloat (_ , _) | Psubfloat (_ , _)
1045
+ | Pmulfloat (_ , _) | Pdivfloat (_ , _)
1030
1046
| Pstringrefu | Pstringrefs | Pbytesrefu | Pbytessetu
1031
1047
| Pbytesrefs | Pbytessets | Pisout | Pread_symbol _
1032
1048
| Pmakeblock (_, _, _, _) | Psetfield (_, _, _) | Psetfield_computed (_, _)
1033
1049
| Pmakeufloatblock (_, _)
1034
1050
| Psetfloatfield (_, _) | Pduprecord (_, _) | Pccall _ | Pdivint _
1035
1051
| Psetufloatfield (_, _)
1036
- | Pmodint _ | Pintcomp _ | Pfloatcomp (Pfloat64 , _) | Punboxed_float_comp (Pfloat64 , _)
1037
- | Pmakearray (_, _, _) | Pcompare_ints | Pcompare_floats Pfloat64 | Pcompare_bints _
1052
+ | Pmodint _ | Pintcomp _ | Pfloatcomp (_ , _) | Punboxed_float_comp (_ , _)
1053
+ | Pmakearray (_, _, _) | Pcompare_ints | Pcompare_floats _ | Pcompare_bints _
1038
1054
| Pduparray (_, _) | Parrayrefu _ | Parraysetu _
1039
1055
| Parrayrefs _ | Parraysets _ | Paddbint _ | Psubbint _ | Pmulbint _
1040
1056
| Pdivbint _ | Pmodbint _ | Pandbint _ | Porbint _ | Pxorbint _
@@ -1115,6 +1131,9 @@ and transl_prim_2 env p arg1 arg2 dbg =
1115
1131
let a1 = transl_unbox_float dbg env arg1 in
1116
1132
let a2 = transl_unbox_float dbg env arg2 in
1117
1133
mk_compare_floats dbg a1 a2
1134
+ | Pcompare_floats Pfloat32 ->
1135
+ Misc. fatal_error
1136
+ " float32 is not supported in the upstream compiler build."
1118
1137
| Pisout ->
1119
1138
transl_isout (transl env arg1) (transl env arg2) dbg
1120
1139
(* Float operations *)
@@ -1148,7 +1167,13 @@ and transl_prim_2 env p arg1 arg2 dbg =
1148
1167
[transl env arg1;
1149
1168
transl env arg2],
1150
1169
dbg)) dbg
1151
-
1170
+ | Paddfloat (Pfloat32 , _)
1171
+ | Psubfloat (Pfloat32 , _)
1172
+ | Pmulfloat (Pfloat32 , _)
1173
+ | Pdivfloat (Pfloat32 , _)
1174
+ | Pfloatcomp (Pfloat32 , _)
1175
+ | Punboxed_float_comp (Pfloat32, _ ) ->
1176
+ Misc. fatal_error " float32 is not supported in the upstream compiler build"
1152
1177
(* String operations *)
1153
1178
| Pstringrefu | Pbytesrefu ->
1154
1179
stringref_unsafe (transl env arg1) (transl env arg2) dbg
@@ -1229,8 +1254,8 @@ and transl_prim_2 env p arg1 arg2 dbg =
1229
1254
[transl env arg1; transl env arg2], dbg)
1230
1255
| Prunstack | Pperform | Presume | Preperform | Pdls_get
1231
1256
| Patomic_cas | Patomic_load _
1232
- | Pnot | Pnegint | Pintoffloat Pfloat64 | Pfloatofint (Pfloat64 , _)
1233
- | Pnegfloat (Pfloat64 , _) | Pabsfloat (Pfloat64 , _)
1257
+ | Pnot | Pnegint | Pintoffloat _ | Pfloatofint (_ , _)
1258
+ | Pnegfloat (_ , _) | Pabsfloat (_ , _)
1234
1259
| Pstringlength | Pbyteslength | Pbytessetu | Pbytessets
1235
1260
| Pisint | Pbswap16 | Pint_as_pointer _ | Popaque | Pread_symbol _
1236
1261
| Pmakeblock (_, _, _, _) | Pfield _ | Psetfield_computed (_, _)
@@ -1241,7 +1266,7 @@ and transl_prim_2 env p arg1 arg2 dbg =
1241
1266
| Pnegbint _ | Pbigarrayref (_, _, _, _) | Pbigarrayset (_, _, _, _)
1242
1267
| Pbigarraydim _ | Pbytes_set _ | Pbigstring_set _ | Pbbswap _
1243
1268
| Pprobe_is_enabled _
1244
- | Punbox_float Pfloat64 | Pbox_float (Pfloat64 , _)
1269
+ | Punbox_float _ | Pbox_float (_ , _)
1245
1270
| Punbox_int _ | Pbox_int _ | Pget_header _
1246
1271
->
1247
1272
fatal_errorf " Cmmgen.transl_prim_2: %a"
@@ -1325,18 +1350,18 @@ and transl_prim_3 env p arg1 arg2 arg3 dbg =
1325
1350
| Patomic_exchange | Patomic_fetch_add | Patomic_load _
1326
1351
| Pfield_computed | Psequand | Psequor | Pnot | Pnegint | Paddint
1327
1352
| Psubint | Pmulint | Pandint | Porint | Pxorint | Plslint | Plsrint | Pasrint
1328
- | Pintoffloat Pfloat64 | Pfloatofint (Pfloat64 , _) | Pnegfloat (Pfloat64 , _)
1329
- | Pabsfloat (Pfloat64 , _) | Paddfloat (Pfloat64 , _) | Psubfloat (Pfloat64 , _)
1330
- | Pmulfloat (Pfloat64 , _) | Pdivfloat (Pfloat64 , _) | Pstringlength
1353
+ | Pintoffloat _ | Pfloatofint (_ , _) | Pnegfloat (_ , _)
1354
+ | Pabsfloat (_ , _) | Paddfloat (_ , _) | Psubfloat (_ , _)
1355
+ | Pmulfloat (_ , _) | Pdivfloat (_ , _) | Pstringlength
1331
1356
| Pstringrefu | Pstringrefs | Pbyteslength | Pbytesrefu | Pbytesrefs | Pisint
1332
1357
| Pisout | Pbswap16 | Pint_as_pointer _ | Popaque | Pread_symbol _
1333
1358
| Pmakeblock (_, _, _, _)
1334
1359
| Pfield _ | Psetfield (_, _, _) | Pfloatfield _ | Psetfloatfield (_, _)
1335
1360
| Pmakeufloatblock (_, _) | Pufloatfield _ | Psetufloatfield (_, _)
1336
1361
| Pduprecord (_, _) | Pccall _ | Praise _ | Pdivint _ | Pmodint _ | Pintcomp _
1337
- | Pcompare_ints | Pcompare_floats Pfloat64 | Pcompare_bints _
1362
+ | Pcompare_ints | Pcompare_floats _ | Pcompare_bints _
1338
1363
| Poffsetint _ | Poffsetref _
1339
- | Pfloatcomp (Pfloat64 , _) | Punboxed_float_comp (Pfloat64 , _)
1364
+ | Pfloatcomp (_ , _) | Punboxed_float_comp (_ , _)
1340
1365
| Pmakearray (_, _, _)
1341
1366
| Pduparray (_, _) | Parraylength _ | Parrayrefu _ | Parrayrefs _
1342
1367
| Pbintofint _ | Pintofbint _ | Pcvtbint _ | Pnegbint _ | Paddbint _
@@ -1346,7 +1371,7 @@ and transl_prim_3 env p arg1 arg2 arg3 dbg =
1346
1371
| Pbigarrayref (_, _, _, _) | Pbigarrayset (_, _, _, _) | Pbigarraydim _
1347
1372
| Pstring_load _ | Pbytes_load _ | Pbigstring_load _ | Pbbswap _
1348
1373
| Pprobe_is_enabled _
1349
- | Punbox_float Pfloat64 | Pbox_float (Pfloat64 , _)
1374
+ | Punbox_float _ | Pbox_float (_ , _)
1350
1375
| Punbox_int _ | Pbox_int _ | Pget_header _
1351
1376
->
1352
1377
fatal_errorf " Cmmgen.transl_prim_3: %a"
@@ -1385,6 +1410,9 @@ and transl_let_value env str (kind : Lambda.value_kind) id exp transl_body =
1385
1410
match str, kind with
1386
1411
| Mutable , Pboxedfloatval Pfloat64 ->
1387
1412
Boxed (Boxed_float (alloc_heap, dbg), false )
1413
+ | _ , Pboxedfloatval Pfloat32 ->
1414
+ Misc. fatal_error
1415
+ " float32 is not supported in the upstream compiler build."
1388
1416
| Mutable , Pboxedintval bi ->
1389
1417
Boxed (Boxed_integer (bi, alloc_heap, dbg), false )
1390
1418
| _ , Pboxedvectorval _ ->
@@ -1439,6 +1467,9 @@ and transl_let env str (layout : Lambda.layout) id exp transl_body =
1439
1467
| Punboxed_vector _ ->
1440
1468
Misc. fatal_error
1441
1469
" SIMD vectors are not supported in the upstream compiler build."
1470
+ | Punboxed_float Pfloat32 ->
1471
+ Misc. fatal_error
1472
+ " float32 is not supported in the upstream compiler build."
1442
1473
| Punboxed_float Pfloat64 | Punboxed_int _ -> begin
1443
1474
let cexp = transl env exp in
1444
1475
let cbody = transl_body env in
0 commit comments