[WebAssembly] Support for floating point min and max.
[oota-llvm.git] / lib / Target / WebAssembly / WebAssemblyInstrFloat.td
index 689aeac62918ba8d6549705460f6c839713a029e..232af03464acd226d79ab87557ac9c9efe5a6a1b 100644 (file)
@@ -22,6 +22,9 @@ defm ABS : UnaryFP<fabs, "abs">;
 defm NEG : UnaryFP<fneg, "neg">;
 defm COPYSIGN : BinaryFP<fcopysign, "copysign">;
 
+defm MIN : BinaryFP<fminnan, "min">;
+defm MAX : BinaryFP<fmaxnan, "max">;
+
 defm CEIL : UnaryFP<fceil, "ceil">;
 defm FLOOR : UnaryFP<ffloor, "floor">;
 defm TRUNC : UnaryFP<ftrunc, "trunc">;
@@ -52,13 +55,6 @@ def : Pat<(setle f64:$lhs, f64:$rhs), (LE_F64 f64:$lhs, f64:$rhs)>;
 def : Pat<(setgt f64:$lhs, f64:$rhs), (GT_F64 f64:$lhs, f64:$rhs)>;
 def : Pat<(setge f64:$lhs, f64:$rhs), (GE_F64 f64:$lhs, f64:$rhs)>;
 
-/*
- * TODO(jfb): Add the following for 32-bit and 64-bit.
- *
- * f32.min: minimum (binary operator); if either operand is NaN, returns NaN
- * f32.max: maximum (binary operator); if either operand is NaN, returns NaN
- */
-
 def SELECT_F32 : I<(outs F32:$dst), (ins I32:$cond, F32:$lhs, F32:$rhs),
                    [(set F32:$dst, (select I32:$cond, F32:$lhs, F32:$rhs))],
                    "f32.select $dst, $cond, $lhs, $rhs">;