1 //===-- WebAssemblyInstrConv.td-WebAssembly Conversion support -*- tablegen -*-=
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief WebAssembly datatype conversions, truncations, reinterpretations,
12 /// promotions, and demotions operand code-gen constructs.
14 //===----------------------------------------------------------------------===//
16 def I64__WRAP_I32 : I<(outs I32:$dst), (ins I64:$src),
17 [(set I32:$dst, (trunc I64:$src))]>;
19 def I32__EXTEND_S_I64 : I<(outs I64:$dst), (ins I32:$src),
20 [(set I64:$dst, (sext I32:$src))]>;
21 def I32__EXTEND_U_I64 : I<(outs I64:$dst), (ins I32:$src),
22 [(set I64:$dst, (zext I32:$src))]>;
24 def F32__TRUNC_S_I32 : I<(outs I32:$dst), (ins F32:$src),
25 [(set I32:$dst, (fp_to_sint F32:$src))]>;
26 def F32__TRUNC_U_I32 : I<(outs I32:$dst), (ins F32:$src),
27 [(set I32:$dst, (fp_to_uint F32:$src))]>;
28 def F32__TRUNC_S_I64 : I<(outs I64:$dst), (ins F32:$src),
29 [(set I64:$dst, (fp_to_sint F32:$src))]>;
30 def F32__TRUNC_U_I64 : I<(outs I64:$dst), (ins F32:$src),
31 [(set I64:$dst, (fp_to_uint F32:$src))]>;
32 def F64__TRUNC_S_I32 : I<(outs I32:$dst), (ins F64:$src),
33 [(set I32:$dst, (fp_to_sint F64:$src))]>;
34 def F64__TRUNC_U_I32 : I<(outs I32:$dst), (ins F64:$src),
35 [(set I32:$dst, (fp_to_uint F64:$src))]>;
36 def F64__TRUNC_S_I64 : I<(outs I64:$dst), (ins F64:$src),
37 [(set I64:$dst, (fp_to_sint F64:$src))]>;
38 def F64__TRUNC_U_I64 : I<(outs I64:$dst), (ins F64:$src),
39 [(set I64:$dst, (fp_to_uint F64:$src))]>;
41 def I32__CONVERT_S_F32 : I<(outs F32:$dst), (ins I32:$src),
42 [(set F32:$dst, (sint_to_fp I32:$src))]>;
43 def I32__CONVERT_U_F32 : I<(outs F32:$dst), (ins I32:$src),
44 [(set F32:$dst, (uint_to_fp I32:$src))]>;
45 def I32__CONVERT_S_F64 : I<(outs F64:$dst), (ins I32:$src),
46 [(set F64:$dst, (sint_to_fp I32:$src))]>;
47 def I32__CONVERT_U_F64 : I<(outs F64:$dst), (ins I32:$src),
48 [(set F64:$dst, (uint_to_fp I32:$src))]>;
49 def I64__CONVERT_S_F32 : I<(outs F32:$dst), (ins I64:$src),
50 [(set F32:$dst, (sint_to_fp I64:$src))]>;
51 def I64__CONVERT_U_F32 : I<(outs F32:$dst), (ins I64:$src),
52 [(set F32:$dst, (uint_to_fp I64:$src))]>;
53 def I64__CONVERT_S_F64 : I<(outs F64:$dst), (ins I64:$src),
54 [(set F64:$dst, (sint_to_fp I64:$src))]>;
55 def I64__CONVERT_U_F64 : I<(outs F64:$dst), (ins I64:$src),
56 [(set F64:$dst, (uint_to_fp I64:$src))]>;
58 def F32__PROMOTE_F64 : I<(outs F64:$dst), (ins F32:$src),
59 [(set F64:$dst, (fextend F32:$src))]>;
60 def F64__DEMOTE_F32 : I<(outs F32:$dst), (ins F64:$src),
61 [(set F32:$dst, (fround F64:$src))]>;
63 def F32__REINTERPRET_I32 : I<(outs I32:$dst), (ins F32:$src),
64 [(set I32:$dst, (bitconvert F32:$src))]>;
65 def I32__REINTERPRET_F32 : I<(outs F32:$dst), (ins I32:$src),
66 [(set F32:$dst, (bitconvert I32:$src))]>;
67 def F64__REINTERPRET_I64 : I<(outs I64:$dst), (ins F64:$src),
68 [(set I64:$dst, (bitconvert F64:$src))]>;
69 def I64__REINTERPRET_F64 : I<(outs F64:$dst), (ins I64:$src),
70 [(set F64:$dst, (bitconvert I64:$src))]>;