blob: 390e90fe3175264f3cc50cbed6d01693447499ec [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
JF Bastien7b452e22015-10-29 04:10:52 +000016def I64__WRAP_I32 : I<(outs I32:$dst), (ins I64:$src),
Dan Gohmand0bf9812015-09-26 01:09:44 +000017 [(set I32:$dst, (trunc I64:$src))]>;
Dan Gohmandc51b962015-10-03 02:10:28 +000018
JF Bastien7b452e22015-10-29 04:10:52 +000019def I32__EXTEND_S_I64 : I<(outs I64:$dst), (ins I32:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000020 [(set I64:$dst, (sext I32:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000021def I32__EXTEND_U_I64 : I<(outs I64:$dst), (ins I32:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000022 [(set I64:$dst, (zext I32:$src))]>;
23
JF Bastien7b452e22015-10-29 04:10:52 +000024def F32__TRUNC_S_I32 : I<(outs I32:$dst), (ins F32:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000025 [(set I32:$dst, (fp_to_sint F32:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000026def F32__TRUNC_U_I32 : I<(outs I32:$dst), (ins F32:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000027 [(set I32:$dst, (fp_to_uint F32:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000028def F32__TRUNC_S_I64 : I<(outs I64:$dst), (ins F32:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000029 [(set I64:$dst, (fp_to_sint F32:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000030def F32__TRUNC_U_I64 : I<(outs I64:$dst), (ins F32:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000031 [(set I64:$dst, (fp_to_uint F32:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000032def F64__TRUNC_S_I32 : I<(outs I32:$dst), (ins F64:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000033 [(set I32:$dst, (fp_to_sint F64:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000034def F64__TRUNC_U_I32 : I<(outs I32:$dst), (ins F64:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000035 [(set I32:$dst, (fp_to_uint F64:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000036def F64__TRUNC_S_I64 : I<(outs I64:$dst), (ins F64:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000037 [(set I64:$dst, (fp_to_sint F64:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000038def F64__TRUNC_U_I64 : I<(outs I64:$dst), (ins F64:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000039 [(set I64:$dst, (fp_to_uint F64:$src))]>;
40
JF Bastien7b452e22015-10-29 04:10:52 +000041def I32__CONVERT_S_F32 : I<(outs F32:$dst), (ins I32:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000042 [(set F32:$dst, (sint_to_fp I32:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000043def I32__CONVERT_U_F32 : I<(outs F32:$dst), (ins I32:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000044 [(set F32:$dst, (uint_to_fp I32:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000045def I32__CONVERT_S_F64 : I<(outs F64:$dst), (ins I32:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000046 [(set F64:$dst, (sint_to_fp I32:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000047def I32__CONVERT_U_F64 : I<(outs F64:$dst), (ins I32:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000048 [(set F64:$dst, (uint_to_fp I32:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000049def I64__CONVERT_S_F32 : I<(outs F32:$dst), (ins I64:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000050 [(set F32:$dst, (sint_to_fp I64:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000051def I64__CONVERT_U_F32 : I<(outs F32:$dst), (ins I64:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000052 [(set F32:$dst, (uint_to_fp I64:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000053def I64__CONVERT_S_F64 : I<(outs F64:$dst), (ins I64:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000054 [(set F64:$dst, (sint_to_fp I64:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000055def I64__CONVERT_U_F64 : I<(outs F64:$dst), (ins I64:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000056 [(set F64:$dst, (uint_to_fp I64:$src))]>;
57
JF Bastien7b452e22015-10-29 04:10:52 +000058def F32__PROMOTE_F64 : I<(outs F64:$dst), (ins F32:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000059 [(set F64:$dst, (fextend F32:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000060def F64__DEMOTE_F32 : I<(outs F32:$dst), (ins F64:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000061 [(set F32:$dst, (fround F64:$src))]>;
62
JF Bastien7b452e22015-10-29 04:10:52 +000063def F32__REINTERPRET_I32 : I<(outs I32:$dst), (ins F32:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000064 [(set I32:$dst, (bitconvert F32:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000065def I32__REINTERPRET_F32 : I<(outs F32:$dst), (ins I32:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000066 [(set F32:$dst, (bitconvert I32:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000067def F64__REINTERPRET_I64 : I<(outs I64:$dst), (ins F64:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000068 [(set I64:$dst, (bitconvert F64:$src))]>;
JF Bastien7b452e22015-10-29 04:10:52 +000069def I64__REINTERPRET_F64 : I<(outs F64:$dst), (ins I64:$src),
Dan Gohmandc51b962015-10-03 02:10:28 +000070 [(set F64:$dst, (bitconvert I64:$src))]>;