[PATCH] D53252: [WebAssembly] Implement vector sext_inreg and tests with comparisons

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 19 15:01:19 PDT 2018


tlively added inline comments.


================
Comment at: test/CodeGen/WebAssembly/simd-comparisons.ll:812
+; SIMD128-NEXT: v128.and $push[[T3:[0-9]+]]=, $pop[[T1]], $pop[[T2]]{{$}}
+; SIMD128-NEXT: v128.and $push[[R:[0-9]+]]=, $pop[[T0]], $pop[[T3]]{{$}}
+; SIMD128-NEXT: return $pop[[R]]{{$}}
----------------
aheejin wrote:
> What is this sequence? Why does one instruction become four? 😨Why does this try to compare `$0` with `$0`?
This is *ordered* not equals, but WebAssembly's `ne` is unordered. This sequence checks `$0 == $0 &&  $1 == $1`, which is true only if neither `$0` or `$1` are NaN. Ordered equals should only return true If `ne` returns true and neither argument is `NaN`.

Other strange sequences below are similar.


================
Comment at: test/CodeGen/WebAssembly/simd-comparisons.ll:910
+; SIMD128-NEXT: f32x4.le $push[[T0:[0-9]+]]=, $0, $1{{$}}
+; SIMD128-NEXT: v128.not $push[[R:[0-9]+]]=, $pop[[T0]]{{$}}
+; SIMD128-NEXT: return $pop[[R]]{{$}}
----------------
aheejin wrote:
> Why doesn't it use `gt_u` directly and does it with two instructions? There are also other similar tests..
If either argument is NaN, `f32x4.le` will return false, so this function will return true, as desired. If we used `f32x4.gt` we would get `false` if either argument is NaN. `gt_u` is for unsigned integers, not floats.


Repository:
  rL LLVM

https://reviews.llvm.org/D53252





More information about the llvm-commits mailing list