[(set I64:$dst, (zext I32:$src))],
"i64.extend_u/i32\t$dst, $src">;
+// Conversion from floating point to integer traps on overflow and invalid.
+let hasSideEffects = 1 in {
def I32_TRUNC_S_F32 : I<(outs I32:$dst), (ins F32:$src),
[(set I32:$dst, (fp_to_sint F32:$src))],
"i32.trunc_s/f32\t$dst, $src">;
def I64_TRUNC_U_F64 : I<(outs I64:$dst), (ins F64:$src),
[(set I64:$dst, (fp_to_uint F64:$src))],
"i64.trunc_u/f64\t$dst, $src">;
+} // hasSideEffects = 1
def F32_CONVERT_S_I32 : I<(outs F32:$dst), (ins I32:$src),
[(set F32:$dst, (sint_to_fp I32:$src))],
let Defs = [ARGUMENTS] in {
+let isCommutable = 1 in
defm ADD : BinaryFP<fadd, "add ">;
defm SUB : BinaryFP<fsub, "sub ">;
+let isCommutable = 1 in
defm MUL : BinaryFP<fmul, "mul ">;
defm DIV : BinaryFP<fdiv, "div ">;
defm SQRT : UnaryFP<fsqrt, "sqrt">;
defm NEG : UnaryFP<fneg, "neg ">;
defm COPYSIGN : BinaryFP<fcopysign, "copysign">;
+let isCommutable = 1 in {
defm MIN : BinaryFP<fminnan, "min ">;
defm MAX : BinaryFP<fmaxnan, "max ">;
+} // isCommutable = 1
defm CEIL : UnaryFP<fceil, "ceil">;
defm FLOOR : UnaryFP<ffloor, "floor">;
let Defs = [ARGUMENTS] in {
+let isCommutable = 1 in {
defm EQ : ComparisonFP<SETOEQ, "eq ">;
defm NE : ComparisonFP<SETUNE, "ne ">;
+} // isCommutable = 1
defm LT : ComparisonFP<SETOLT, "lt ">;
defm LE : ComparisonFP<SETOLE, "le ">;
defm GT : ComparisonFP<SETOGT, "gt ">;
defm : LOCAL<F32>;
defm : LOCAL<F64>;
+let isMoveImm = 1 in {
def CONST_I32 : I<(outs I32:$res), (ins i32imm:$imm),
[(set I32:$res, imm:$imm)],
"i32.const\t$res, $imm">;
def CONST_F64 : I<(outs F64:$res), (ins f64imm:$imm),
[(set F64:$res, fpimm:$imm)],
"f64.const\t$res, $imm">;
+} // isMoveImm = 1
} // Defs = [ARGUMENTS]
// The spaces after the names are for aesthetic purposes only, to make
// operands line up vertically after tab expansion.
+let isCommutable = 1 in
defm ADD : BinaryInt<add, "add ">;
defm SUB : BinaryInt<sub, "sub ">;
+let isCommutable = 1 in
defm MUL : BinaryInt<mul, "mul ">;
+// Divide and remainder trap on a zero denominator.
+let hasSideEffects = 1 in {
defm DIV_S : BinaryInt<sdiv, "div_s">;
defm DIV_U : BinaryInt<udiv, "div_u">;
defm REM_S : BinaryInt<srem, "rem_s">;
defm REM_U : BinaryInt<urem, "rem_u">;
+} // hasSideEffects = 1
+let isCommutable = 1 in {
defm AND : BinaryInt<and, "and ">;
defm OR : BinaryInt<or, "or ">;
defm XOR : BinaryInt<xor, "xor ">;
+} // isCommutable = 1
defm SHL : BinaryInt<shl, "shl ">;
defm SHR_U : BinaryInt<srl, "shr_u">;
defm SHR_S : BinaryInt<sra, "shr_s">;
+let isCommutable = 1 in {
defm EQ : ComparisonInt<SETEQ, "eq ">;
defm NE : ComparisonInt<SETNE, "ne ">;
+} // isCommutable = 1
defm LT_S : ComparisonInt<SETLT, "lt_s">;
defm LE_S : ComparisonInt<SETLE, "le_s">;
defm LT_U : ComparisonInt<SETULT, "lt_u">;