@@ -1172,6 +1172,7 @@ let can_group discr pat =
1172
1172
| Constant (Const_char _), Constant (Const_char _)
1173
1173
| Constant (Const_string _), Constant (Const_string _)
1174
1174
| Constant (Const_float _), Constant (Const_float _)
1175
+ | Constant (Const_unboxed_float _), Constant (Const_unboxed_float _)
1175
1176
| Constant (Const_int32 _), Constant (Const_int32 _)
1176
1177
| Constant (Const_int64 _), Constant (Const_int64 _)
1177
1178
| Constant (Const_nativeint _ ), Constant (Const_nativeint _ ) ->
@@ -1195,7 +1196,7 @@ let can_group discr pat =
1195
1196
( Any
1196
1197
| Constant
1197
1198
( Const_int _ | Const_char _ | Const_string _ | Const_float _
1198
- | Const_int32 _ | Const_int64 _ | Const_nativeint _ )
1199
+ | Const_unboxed_float _ | Const_int32 _ | Const_int64 _ | Const_nativeint _ )
1199
1200
| Construct _ | Tuple _ | Record _ | Array _ | Variant _ | Lazy ) ) ->
1200
1201
false
1201
1202
@@ -2399,7 +2400,7 @@ let rec do_tests_fail value_kind loc fail tst arg = function
2399
2400
| [] -> fail
2400
2401
| (c , act ) :: rem ->
2401
2402
Lifthenelse
2402
- ( Lprim (tst, [ arg; Lconst ( Const_base c) ], loc),
2403
+ ( Lprim (tst, [ arg; c ], loc),
2403
2404
do_tests_fail value_kind loc fail tst arg rem,
2404
2405
act, value_kind )
2405
2406
@@ -2408,15 +2409,16 @@ let rec do_tests_nofail value_kind loc tst arg = function
2408
2409
| [ (_, act) ] -> act
2409
2410
| (c , act ) :: rem ->
2410
2411
Lifthenelse
2411
- ( Lprim (tst, [ arg; Lconst ( Const_base c) ], loc),
2412
+ ( Lprim (tst, [ arg; c ], loc),
2412
2413
do_tests_nofail value_kind loc tst arg rem,
2413
2414
act, value_kind )
2414
2415
2415
- let make_test_sequence value_kind loc fail tst lt_tst arg const_lambda_list =
2416
+ let make_test_sequence value_kind loc fail tst lt_tst arg const_lambda_list transl_const =
2416
2417
let const_lambda_list = sort_lambda_list const_lambda_list in
2417
2418
let hs, const_lambda_list, fail =
2418
2419
share_actions_tree value_kind const_lambda_list fail
2419
2420
in
2421
+ let const_lambda_list = List. map (fun (c , l ) -> transl_const c, l) const_lambda_list in
2420
2422
let rec make_test_sequence const_lambda_list =
2421
2423
if List. length const_lambda_list > = 4 && lt_tst <> Pignore then
2422
2424
split_sequence const_lambda_list
@@ -2429,7 +2431,7 @@ let make_test_sequence value_kind loc fail tst lt_tst arg const_lambda_list =
2429
2431
rev_split_at (List. length const_lambda_list / 2 ) const_lambda_list
2430
2432
in
2431
2433
Lifthenelse
2432
- ( Lprim (lt_tst, [ arg; Lconst ( Const_base ( fst (List. hd list2)) ) ], loc),
2434
+ ( Lprim (lt_tst, [ arg; fst (List. hd list2) ], loc),
2433
2435
make_test_sequence list1,
2434
2436
make_test_sequence list2, value_kind )
2435
2437
in
@@ -2826,6 +2828,16 @@ let mk_failaction_pos partial seen ctx defs =
2826
2828
let combine_constant value_kind loc arg cst partial ctx def
2827
2829
(const_lambda_list , total , _pats ) =
2828
2830
let fail, local_jumps = mk_failaction_neg partial ctx def in
2831
+ let transl_const = function
2832
+ | Const_int c -> Lconst (Const_base (Const_int c))
2833
+ | Const_char c -> Lconst (Const_base (Const_char c))
2834
+ | Const_string (s ,loc ,d ) -> Lconst (Const_base (Const_string (s,loc,d)))
2835
+ | Const_float c -> Lconst (Const_base (Const_float c))
2836
+ | Const_int32 c -> Lconst (Const_base (Const_int32 c))
2837
+ | Const_int64 c -> Lconst (Const_base (Const_int64 c))
2838
+ | Const_nativeint c -> Lconst (Const_base (Const_nativeint c))
2839
+ | Const_unboxed_float f -> Lconst (Const_base (Const_float f))
2840
+ in
2829
2841
let lambda1 =
2830
2842
match cst with
2831
2843
| Const_int _ ->
@@ -2865,22 +2877,28 @@ let combine_constant value_kind loc arg cst partial ctx def
2865
2877
| Const_float _ ->
2866
2878
make_test_sequence value_kind loc fail (Pfloatcomp CFneq )
2867
2879
(Pfloatcomp CFlt ) arg
2868
- const_lambda_list
2880
+ const_lambda_list transl_const
2881
+ | Const_unboxed_float _ ->
2882
+ make_test_sequence value_kind loc fail
2883
+ (Pfloatcomp CFneq )
2884
+ (Pfloatcomp CFlt )
2885
+ (Lprim (Pbox_float Lambda. alloc_local, [arg], loc))
2886
+ const_lambda_list transl_const
2869
2887
| Const_int32 _ ->
2870
2888
make_test_sequence value_kind loc fail
2871
2889
(Pbintcomp (Pint32 , Cne ))
2872
2890
(Pbintcomp (Pint32 , Clt ))
2873
- arg const_lambda_list
2891
+ arg const_lambda_list transl_const
2874
2892
| Const_int64 _ ->
2875
2893
make_test_sequence value_kind loc fail
2876
2894
(Pbintcomp (Pint64 , Cne ))
2877
2895
(Pbintcomp (Pint64 , Clt ))
2878
- arg const_lambda_list
2896
+ arg const_lambda_list transl_const
2879
2897
| Const_nativeint _ ->
2880
2898
make_test_sequence value_kind loc fail
2881
2899
(Pbintcomp (Pnativeint , Cne ))
2882
2900
(Pbintcomp (Pnativeint , Clt ))
2883
- arg const_lambda_list
2901
+ arg const_lambda_list transl_const
2884
2902
in
2885
2903
(lambda1, Jumps. union local_jumps total)
2886
2904
0 commit comments