[WebAssembly] Set several MCInstrDesc flags.
authorDan Gohman <dan433584@gmail.com>
Sun, 29 Nov 2015 22:59:19 +0000 (22:59 +0000)
committerDan Gohman <dan433584@gmail.com>
Sun, 29 Nov 2015 22:59:19 +0000 (22:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254271 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/WebAssembly/WebAssemblyInstrConv.td
lib/Target/WebAssembly/WebAssemblyInstrFloat.td
lib/Target/WebAssembly/WebAssemblyInstrInfo.td
lib/Target/WebAssembly/WebAssemblyInstrInteger.td

index a34916eb5a2d9d7c606c143899f51f448fa90e92..4926b8fd8725e919cca59c8b4e661f6d9a879330 100644 (file)
@@ -26,6 +26,8 @@ def I64_EXTEND_U_I32 : I<(outs I64:$dst), (ins I32:$src),
                          [(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">;
@@ -50,6 +52,7 @@ def I64_TRUNC_S_F64 : I<(outs I64:$dst), (ins F64:$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))],
index 0d819581621e210ed588023c90a282a953579270..d966380e6b0cfe54c475af338b31ebddad8ce0a2 100644 (file)
 
 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">;
@@ -24,8 +26,10 @@ defm ABS : UnaryFP<fabs, "abs ">;
 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">;
@@ -40,8 +44,10 @@ def : Pat<(frint f64:$src), (NEAREST_F64 f64:$src)>;
 
 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  ">;
index 52e0bd6e97f5b588a69ed4a0cafe3f889f8cb9b1..caffac1bc52bfb2634473fa2057bdde0c66d1012 100644 (file)
@@ -115,6 +115,7 @@ defm : LOCAL<I64>;
 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">;
@@ -127,6 +128,7 @@ def CONST_F32 : I<(outs F32:$res), (ins f32imm:$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]
 
index 3fa2f712034ad0dc68f8726e4d33e7cd1f7dc983..09e5eafb85e9ac21261233663e0f7a248cdd99b5 100644 (file)
@@ -16,22 +16,31 @@ let Defs = [ARGUMENTS] in {
 
 // 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">;