1// WebAssemblyInstrFloat.td-WebAssembly Float codegen 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 Floating-point operand code-gen constructs. 12/// 13//===----------------------------------------------------------------------===// 14 15defm FADD : BinaryFP<fadd>; 16defm FSUB : BinaryFP<fsub>; 17defm FMUL : BinaryFP<fmul>; 18defm FDIV : BinaryFP<fdiv>; 19defm FABS : UnaryFP<fabs>; 20defm FNEG : UnaryFP<fneg>; 21defm COPYSIGN : BinaryFP<fcopysign>; 22 23/* 24 * TODO(jfb): add and test these: 25 * defm CEIL : UnaryFP<fceil>; 26 * defm FLOOR : UnaryFP<ffloor>; 27 * defm TRUNC : UnaryFP<ftrunc>; 28 * defm NEARESTINT : UnaryFP<fnearbyint>; 29 */ 30 31defm EQ : ComparisonFP<SETOEQ>; 32defm NE : ComparisonFP<SETUNE>; 33defm LT : ComparisonFP<SETOLT>; 34defm LE : ComparisonFP<SETOLE>; 35defm GT : ComparisonFP<SETOGT>; 36defm GE : ComparisonFP<SETOGE>; 37 38// Don't care floating-point comparisons, supported via other comparisons. 39def : Pat<(seteq f32:$lhs, f32:$rhs), (EQ_F32 f32:$lhs, f32:$rhs)>; 40def : Pat<(setne f32:$lhs, f32:$rhs), (NE_F32 f32:$lhs, f32:$rhs)>; 41def : Pat<(setlt f32:$lhs, f32:$rhs), (LT_F32 f32:$lhs, f32:$rhs)>; 42def : Pat<(setle f32:$lhs, f32:$rhs), (LE_F32 f32:$lhs, f32:$rhs)>; 43def : Pat<(setgt f32:$lhs, f32:$rhs), (GT_F32 f32:$lhs, f32:$rhs)>; 44def : Pat<(setge f32:$lhs, f32:$rhs), (GE_F32 f32:$lhs, f32:$rhs)>; 45def : Pat<(seteq f64:$lhs, f64:$rhs), (EQ_F64 f64:$lhs, f64:$rhs)>; 46def : Pat<(setne f64:$lhs, f64:$rhs), (NE_F64 f64:$lhs, f64:$rhs)>; 47def : Pat<(setlt f64:$lhs, f64:$rhs), (LT_F64 f64:$lhs, f64:$rhs)>; 48def : Pat<(setle f64:$lhs, f64:$rhs), (LE_F64 f64:$lhs, f64:$rhs)>; 49def : Pat<(setgt f64:$lhs, f64:$rhs), (GT_F64 f64:$lhs, f64:$rhs)>; 50def : Pat<(setge f64:$lhs, f64:$rhs), (GE_F64 f64:$lhs, f64:$rhs)>; 51 52defm SQRT : UnaryFP<fsqrt>; 53 54/* 55 * TODO(jfb): Add the following for 32-bit and 64-bit. 56 * 57 * float32.min: minimum (binary operator); if either operand is NaN, returns NaN 58 * float32.max: maximum (binary operator); if either operand is NaN, returns NaN 59 */ 60