blob: a4ae5fe7c6dc99b4d94f275496aacb50f08aca07 [file] [log] [blame]
JF Bastien5ca0bac2015-07-10 18:23:10 +00001//===-- WebAssemblyInstrConv.td-WebAssembly Conversion support -*- tablegen -*-=
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9///
10/// \file
11/// \brief WebAssembly datatype conversions, truncations, reinterpretations,
12/// promotions, and demotions operand code-gen constructs.
13///
14//===----------------------------------------------------------------------===//
15
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000016def I32_WRAP_I64 : I<(outs I32:$dst), (ins I64:$src),
17 [(set I32:$dst, (trunc I64:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000018 "i32.wrap/i64\t$dst, $src">;
Dan Gohmandc51b962015-10-03 02:10:28 +000019
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000020def I64_EXTEND_S_I32 : I<(outs I64:$dst), (ins I32:$src),
21 [(set I64:$dst, (sext I32:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000022 "i64.extend_s/i32\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000023def I64_EXTEND_U_I32 : I<(outs I64:$dst), (ins I32:$src),
24 [(set I64:$dst, (zext I32:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000025 "i64.extend_u/i32\t$dst, $src">;
Dan Gohmandc51b962015-10-03 02:10:28 +000026
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000027def I32_TRUNC_S_F32 : I<(outs I32:$dst), (ins F32:$src),
28 [(set I32:$dst, (fp_to_sint F32:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000029 "i32.trunc_s/f32\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000030def I32_TRUNC_U_F32 : I<(outs I32:$dst), (ins F32:$src),
31 [(set I32:$dst, (fp_to_uint F32:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000032 "i32.trunc_u/f32\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000033def I64_TRUNC_S_F32 : I<(outs I64:$dst), (ins F32:$src),
34 [(set I64:$dst, (fp_to_sint F32:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000035 "i64.trunc_s/f32\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000036def I64_TRUNC_U_F32 : I<(outs I64:$dst), (ins F32:$src),
37 [(set I64:$dst, (fp_to_uint F32:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000038 "i64.trunc_u/f32\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000039def I32_TRUNC_S_F64 : I<(outs I32:$dst), (ins F64:$src),
40 [(set I32:$dst, (fp_to_sint F64:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000041 "i32.trunc_s/f64\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000042def I32_TRUNC_U_F64 : I<(outs I32:$dst), (ins F64:$src),
43 [(set I32:$dst, (fp_to_uint F64:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000044 "i32.trunc_u/f64\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000045def I64_TRUNC_S_F64 : I<(outs I64:$dst), (ins F64:$src),
46 [(set I64:$dst, (fp_to_sint F64:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000047 "i64.trunc_s/f64\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000048def I64_TRUNC_U_F64 : I<(outs I64:$dst), (ins F64:$src),
49 [(set I64:$dst, (fp_to_uint F64:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000050 "i64.trunc_u/f64\t$dst, $src">;
Dan Gohmandc51b962015-10-03 02:10:28 +000051
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000052def F32_CONVERT_S_I32 : I<(outs F32:$dst), (ins I32:$src),
53 [(set F32:$dst, (sint_to_fp I32:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000054 "f32.convert_s/i32\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000055def F32_CONVERT_U_I32 : I<(outs F32:$dst), (ins I32:$src),
56 [(set F32:$dst, (uint_to_fp I32:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000057 "f32.convert_u/i32\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000058def F64_CONVERT_S_I32 : I<(outs F64:$dst), (ins I32:$src),
59 [(set F64:$dst, (sint_to_fp I32:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000060 "f64.convert_s/i32\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000061def F64_CONVERT_U_I32 : I<(outs F64:$dst), (ins I32:$src),
62 [(set F64:$dst, (uint_to_fp I32:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000063 "f64.convert_u/i32\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000064def F32_CONVERT_S_I64 : I<(outs F32:$dst), (ins I64:$src),
65 [(set F32:$dst, (sint_to_fp I64:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000066 "f32.convert_s/i64\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000067def F32_CONVERT_U_I64 : I<(outs F32:$dst), (ins I64:$src),
68 [(set F32:$dst, (uint_to_fp I64:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000069 "f32.convert_u/i64\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000070def F64_CONVERT_S_I64 : I<(outs F64:$dst), (ins I64:$src),
71 [(set F64:$dst, (sint_to_fp I64:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000072 "f64.convert_s/i64\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000073def F64_CONVERT_U_I64 : I<(outs F64:$dst), (ins I64:$src),
74 [(set F64:$dst, (uint_to_fp I64:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000075 "f64.convert_u/i64\t$dst, $src">;
Dan Gohmandc51b962015-10-03 02:10:28 +000076
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000077def F64_PROMOTE_F32 : I<(outs F64:$dst), (ins F32:$src),
78 [(set F64:$dst, (fextend F32:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000079 "f64.promote/f32\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000080def F32_DEMOTE_F64 : I<(outs F32:$dst), (ins F64:$src),
81 [(set F32:$dst, (fround F64:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000082 "f32.demote/f64\t$dst, $src">;
Dan Gohmandc51b962015-10-03 02:10:28 +000083
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000084def I32_REINTERPRET_F32 : I<(outs I32:$dst), (ins F32:$src),
85 [(set I32:$dst, (bitconvert F32:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000086 "i32.reinterpret/f32\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000087def F32_REINTERPRET_I32 : I<(outs F32:$dst), (ins I32:$src),
88 [(set F32:$dst, (bitconvert I32:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000089 "f32.reinterpret/i32\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000090def I64_REINTERPRET_F64 : I<(outs I64:$dst), (ins F64:$src),
91 [(set I64:$dst, (bitconvert F64:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000092 "i64.reinterpret/f64\t$dst, $src">;
Dan Gohmanbc58a7b2015-11-13 00:50:04 +000093def F64_REINTERPRET_I64 : I<(outs F64:$dst), (ins I64:$src),
94 [(set F64:$dst, (bitconvert I64:$src))],
Dan Gohman1031d4a2015-11-15 15:34:19 +000095 "f64.reinterpret/i64\t$dst, $src">;