This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Implement vector sext_inreg and tests with comparisons
ClosedPublic

Authored by tlively on Oct 13 2018, 10:36 PM.

Diff Detail

Event Timeline

tlively created this revision.Oct 13 2018, 10:36 PM
nhaehnle removed a subscriber: nhaehnle.Oct 16 2018, 8:18 AM

Apparently what you did is just to expand SEXT_INREG, but I'm not sure why do results of some existing test cases that used to work well with a single instruction now have several instructions..?

test/CodeGen/WebAssembly/simd-comparisons.ll
812

What is this sequence? Why does one instruction become four? 😨Why does this try to compare $0 with $0?

910

Why doesn't it use gt_u directly and does it with two instructions? There are also other similar tests..

tlively added inline comments.Oct 19 2018, 3:00 PM
test/CodeGen/WebAssembly/simd-comparisons.ll
812

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.

910

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.

tlively updated this revision to Diff 170260.Oct 19 2018, 3:06 PM
  • Add missing test
aheejin accepted this revision.Oct 19 2018, 5:24 PM
This revision is now accepted and ready to land.Oct 19 2018, 5:24 PM
aheejin added inline comments.Oct 19 2018, 5:25 PM
test/CodeGen/WebAssembly/simd-comparisons.ll
812

I see, so before they were also generated but test didn't include them. Thanks.

This revision was automatically updated to reflect the committed changes.