@@ -594,18 +594,20 @@ let module_ = module_with_var_opt None
594
594
(* Scripts *)
595
595
596
596
(* Converts a value to string depending on mode. *)
597
- let literal mode lit =
597
+ let literal mode lit shape =
598
598
let choose_mode bin not_bin = if mode = `Binary then bin else not_bin in
599
- match lit.it with
600
- | Values. I32 i -> choose_mode I32. to_hex_string I32. to_string_s i
601
- | Values. I64 i -> choose_mode I64. to_hex_string I64. to_string_s i
602
- | Values. F32 z -> choose_mode F32. to_hex_string F32. to_string z
603
- | Values. F64 z -> choose_mode F64. to_hex_string F64. to_string z
604
- | Values. V128 v -> choose_mode V128. to_hex_string V128. to_string v
599
+ match lit.it, shape with
600
+ | Values. I32 i , Some Simd. I8x16 -> choose_mode I8. to_hex_string I8. to_string_s i
601
+ | Values. I32 i , Some Simd. I16x8 -> choose_mode I16. to_hex_string I16. to_string_s i
602
+ | Values. I32 i , _ -> choose_mode I32. to_hex_string I32. to_string_s i
603
+ | Values. I64 i , _ -> choose_mode I64. to_hex_string I64. to_string_s i
604
+ | Values. F32 z , _ -> choose_mode F32. to_hex_string F32. to_string z
605
+ | Values. F64 z , _ -> choose_mode F64. to_hex_string F64. to_string z
606
+ | Values. V128 v , _ -> choose_mode V128. to_hex_string V128. to_string v
605
607
606
608
(* Converts a literal into a constant instruction. *)
607
609
let constant mode lit =
608
- let lit_string = literal mode lit in
610
+ let lit_string = literal mode lit None in
609
611
Node (constop lit ^ lit_string, [] )
610
612
611
613
let definition mode x_opt def =
@@ -661,7 +663,7 @@ let result_simd mode res shape pats =
661
663
* a SimdResult do not need the i32.const instruction *)
662
664
let num_pat mode res =
663
665
match res.it with
664
- | LitPat lit -> literal mode lit
666
+ | LitPat lit -> literal mode lit ( Some shape)
665
667
| NanPat {it = Values. F32 n; _}
666
668
| NanPat {it = Values. F64 n ; _} -> nan n
667
669
| _ -> assert false
0 commit comments