blob: 6783707e8e9e4c0f447850e8a660fef0535129d6 [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 Gohmanaf29bd42015-11-05 20:42:30 +000016def i64__WRAP_i32 : I<(outs I32:$dst), (ins I64:$src),
17 [(set I32:$dst, (trunc I64:$src))],
18 "i32.wrap/i64 $dst, $src">;
Dan Gohmandc51b962015-10-03 02:10:28 +000019
JF Bastien7b452e22015-10-29 04:10:52 +000020def I32__EXTEND_S_I64 : I<(outs I64:$dst), (ins I32:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000021 [(set I64:$dst, (sext I32:$src))],
22 "i64.extend_s/i32 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000023def I32__EXTEND_U_I64 : I<(outs I64:$dst), (ins I32:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000024 [(set I64:$dst, (zext I32:$src))],
25 "i64.extend_u/i32 $dst, $src">;
Dan Gohmandc51b962015-10-03 02:10:28 +000026
JF Bastien7b452e22015-10-29 04:10:52 +000027def F32__TRUNC_S_I32 : I<(outs I32:$dst), (ins F32:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000028 [(set I32:$dst, (fp_to_sint F32:$src))],
29 "i32.trunc_s/f32 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000030def F32__TRUNC_U_I32 : I<(outs I32:$dst), (ins F32:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000031 [(set I32:$dst, (fp_to_uint F32:$src))],
32 "i32.trunc_u/f32 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000033def F32__TRUNC_S_I64 : I<(outs I64:$dst), (ins F32:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000034 [(set I64:$dst, (fp_to_sint F32:$src))],
35 "i64.trunc_s/f32 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000036def F32__TRUNC_U_I64 : I<(outs I64:$dst), (ins F32:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000037 [(set I64:$dst, (fp_to_uint F32:$src))],
38 "i64.trunc_u/f32 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000039def F64__TRUNC_S_I32 : I<(outs I32:$dst), (ins F64:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000040 [(set I32:$dst, (fp_to_sint F64:$src))],
41 "i32.trunc_s/f64 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000042def F64__TRUNC_U_I32 : I<(outs I32:$dst), (ins F64:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000043 [(set I32:$dst, (fp_to_uint F64:$src))],
44 "i32.trunc_u/f64 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000045def F64__TRUNC_S_I64 : I<(outs I64:$dst), (ins F64:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000046 [(set I64:$dst, (fp_to_sint F64:$src))],
47 "i64.trunc_s/f64 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000048def F64__TRUNC_U_I64 : I<(outs I64:$dst), (ins F64:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000049 [(set I64:$dst, (fp_to_uint F64:$src))],
50 "i64.trunc_u/f64 $dst, $src">;
Dan Gohmandc51b962015-10-03 02:10:28 +000051
JF Bastien7b452e22015-10-29 04:10:52 +000052def I32__CONVERT_S_F32 : I<(outs F32:$dst), (ins I32:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000053 [(set F32:$dst, (sint_to_fp I32:$src))],
54 "f32.convert_s/i32 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000055def I32__CONVERT_U_F32 : I<(outs F32:$dst), (ins I32:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000056 [(set F32:$dst, (uint_to_fp I32:$src))],
57 "f32.convert_u/i32 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000058def I32__CONVERT_S_F64 : I<(outs F64:$dst), (ins I32:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000059 [(set F64:$dst, (sint_to_fp I32:$src))],
60 "f64.convert_s/i32 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000061def I32__CONVERT_U_F64 : I<(outs F64:$dst), (ins I32:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000062 [(set F64:$dst, (uint_to_fp I32:$src))],
63 "f64.convert_u/i32 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000064def I64__CONVERT_S_F32 : I<(outs F32:$dst), (ins I64:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000065 [(set F32:$dst, (sint_to_fp I64:$src))],
66 "f32.convert_s/i64 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000067def I64__CONVERT_U_F32 : I<(outs F32:$dst), (ins I64:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000068 [(set F32:$dst, (uint_to_fp I64:$src))],
69 "f32.convert_u/i64 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000070def I64__CONVERT_S_F64 : I<(outs F64:$dst), (ins I64:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000071 [(set F64:$dst, (sint_to_fp I64:$src))],
72 "f64.convert_s/i64 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000073def I64__CONVERT_U_F64 : I<(outs F64:$dst), (ins I64:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000074 [(set F64:$dst, (uint_to_fp I64:$src))],
75 "f64.convert_u/i64 $dst, $src">;
Dan Gohmandc51b962015-10-03 02:10:28 +000076
JF Bastien7b452e22015-10-29 04:10:52 +000077def F32__PROMOTE_F64 : I<(outs F64:$dst), (ins F32:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000078 [(set F64:$dst, (fextend F32:$src))],
79 "f64.promote/f32 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000080def F64__DEMOTE_F32 : I<(outs F32:$dst), (ins F64:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000081 [(set F32:$dst, (fround F64:$src))],
82 "f32.demote/f64 $dst, $src">;
Dan Gohmandc51b962015-10-03 02:10:28 +000083
JF Bastien7b452e22015-10-29 04:10:52 +000084def F32__REINTERPRET_I32 : I<(outs I32:$dst), (ins F32:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000085 [(set I32:$dst, (bitconvert F32:$src))],
86 "i32.reinterpret/f32 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000087def I32__REINTERPRET_F32 : I<(outs F32:$dst), (ins I32:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000088 [(set F32:$dst, (bitconvert I32:$src))],
89 "f32.reinterpret/i32 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000090def F64__REINTERPRET_I64 : I<(outs I64:$dst), (ins F64:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000091 [(set I64:$dst, (bitconvert F64:$src))],
92 "i64.reinterpret/f64 $dst, $src">;
JF Bastien7b452e22015-10-29 04:10:52 +000093def I64__REINTERPRET_F64 : I<(outs F64:$dst), (ins I64:$src),
Dan Gohmanaf29bd42015-11-05 20:42:30 +000094 [(set F64:$dst, (bitconvert I64:$src))],
95 "f64.reinterpret/i64 $dst, $src">;