diff options
| author | Thomas Lively <tlively@google.com> | 2018-10-11 18:45:48 +0000 | 
|---|---|---|
| committer | Thomas Lively <tlively@google.com> | 2018-10-11 18:45:48 +0000 | 
| commit | ab37189f7eb05e427170f60902d1964cf9ee4c95 (patch) | |
| tree | ad7000a1c824994a10567dd99e9a4f52986266de /llvm/lib/Target/WebAssembly/WebAssemblyInstrFloat.td | |
| parent | e8a6c3eb9628e9833ae41196dc52a5c47041e3e6 (diff) | |
| download | bcm5719-llvm-ab37189f7eb05e427170f60902d1964cf9ee4c95.tar.gz bcm5719-llvm-ab37189f7eb05e427170f60902d1964cf9ee4c95.zip  | |
[WebAssembly] Revert rL344180, which was breaking expensive checks
llvm-svn: 344280
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyInstrFloat.td')
| -rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyInstrFloat.td | 12 | 
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrFloat.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrFloat.td index 364c485f409..70e27df27e6 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrFloat.td +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrFloat.td @@ -45,6 +45,8 @@ multiclass ComparisonFP<CondCode cond, string name, bits<32> f32Inst, bits<32> f                  !strconcat("f64.", name), f64Inst>;  } +let Defs = [ARGUMENTS] in { +  let isCommutable = 1 in  defm ADD : BinaryFP<fadd, "add ", 0x92, 0xa0>;  defm SUB : BinaryFP<fsub, "sub ", 0x93, 0xa1>; @@ -67,6 +69,8 @@ defm FLOOR : UnaryFP<ffloor, "floor", 0x8e, 0x9c>;  defm TRUNC : UnaryFP<ftrunc, "trunc", 0x8f, 0x9d>;  defm NEAREST : UnaryFP<fnearbyint, "nearest", 0x90, 0x9e>; +} // Defs = [ARGUMENTS] +  // DAGCombine oddly folds casts into the rhs of copysign. Unfold them.  def : Pat<(fcopysign F64:$lhs, F32:$rhs),            (COPYSIGN_F64 F64:$lhs, (F64_PROMOTE_F32 F32:$rhs))>; @@ -77,6 +81,8 @@ def : Pat<(fcopysign F32:$lhs, F64:$rhs),  def : Pat<(frint f32:$src), (NEAREST_F32 f32:$src)>;  def : Pat<(frint f64:$src), (NEAREST_F64 f64:$src)>; +let Defs = [ARGUMENTS] in { +  let isCommutable = 1 in {  defm EQ : ComparisonFP<SETOEQ, "eq  ", 0x5b, 0x61>;  defm NE : ComparisonFP<SETUNE, "ne  ", 0x5c, 0x62>; @@ -86,6 +92,8 @@ defm LE : ComparisonFP<SETOLE, "le  ", 0x5f, 0x65>;  defm GT : ComparisonFP<SETOGT, "gt  ", 0x5e, 0x64>;  defm GE : ComparisonFP<SETOGE, "ge  ", 0x60, 0x66>; +} // Defs = [ARGUMENTS] +  // Don't care floating-point comparisons, supported via other comparisons.  def : Pat<(seteq f32:$lhs, f32:$rhs), (EQ_F32 f32:$lhs, f32:$rhs)>;  def : Pat<(setne f32:$lhs, f32:$rhs), (NE_F32 f32:$lhs, f32:$rhs)>; @@ -100,6 +108,8 @@ 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)>; +let Defs = [ARGUMENTS] in { +  defm SELECT_F32 : I<(outs F32:$dst), (ins F32:$lhs, F32:$rhs, I32:$cond),                      (outs), (ins),                      [(set F32:$dst, (select I32:$cond, F32:$lhs, F32:$rhs))], @@ -109,6 +119,8 @@ defm SELECT_F64 : I<(outs F64:$dst), (ins F64:$lhs, F64:$rhs, I32:$cond),                      [(set F64:$dst, (select I32:$cond, F64:$lhs, F64:$rhs))],                      "f64.select\t$dst, $lhs, $rhs, $cond", "f64.select", 0x1b>; +} // Defs = [ARGUMENTS] +  // ISD::SELECT requires its operand to conform to getBooleanContents, but  // WebAssembly's select interprets any non-zero value as true, so we can fold  // a setne with 0 into a select.  | 

