Implement wasm saturating conversions;

This commit is contained in:
Benjamin Bouvier
2018-07-27 19:11:39 +02:00
committed by Dan Gohman
parent 9dbfbbde10
commit f7e481d9ac
5 changed files with 305 additions and 31 deletions

View File

@@ -1879,6 +1879,14 @@ fcvt_to_uint = Instruction(
""",
ins=x, outs=a, can_trap=True)
fcvt_to_uint_sat = Instruction(
'fcvt_to_uint_sat', r"""
Convert floating point to unsigned integer as fcvt_to_uint does, but
saturates the input instead of trapping. NaN and negative values are
converted to 0.
""",
ins=x, outs=a)
fcvt_to_sint = Instruction(
'fcvt_to_sint', r"""
Convert floating point to signed integer.
@@ -1891,6 +1899,13 @@ fcvt_to_sint = Instruction(
""",
ins=x, outs=a, can_trap=True)
fcvt_to_sint_sat = Instruction(
'fcvt_to_sint_sat', r"""
Convert floating point to signed integer as fcvt_to_sint does, but
saturates the input instead of trapping. NaN values are converted to 0.
""",
ins=x, outs=a)
x = Operand('x', Int)
a = Operand('a', FloatTo)