This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] SIMD min and max
ClosedPublic

Authored by tlively on Sep 20 2018, 2:35 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

tlively created this revision.Sep 20 2018, 2:35 PM

What happens if we use ordered comparisons? They fail to be selected?

tlively updated this revision to Diff 166790.Sep 24 2018, 5:23 PM
  • Update tests to use nonzero constant vectors

What happens if we use ordered comparisons? They fail to be selected?

I would expect ordered comparisons to lower to fminnan/fmaxnan if the constant vector was on the left hand side and the variable vector was on the right hand side. That way, any NaNs in the variable vector would compare as false and then be returned when the select chooses the right hand side.

Then maybe it's better to add test for ordered ones too..?

tlively updated this revision to Diff 166948.EditedSep 25 2018, 10:41 AM
  • Refactor dependent CLs
  • Add tests for ordered comparison patterns
aheejin added inline comments.Sep 25 2018, 3:47 PM
test/CodeGen/WebAssembly/simd-arith.ll
725 ↗(On Diff #166948)

If we have a constant vector in the right hand side, it will be still lowered to f32x4.min, right?

tlively added inline comments.Sep 25 2018, 4:46 PM
test/CodeGen/WebAssembly/simd-arith.ll
725 ↗(On Diff #166948)

No, not with an ordered comparison. If the constant (non-zero, non-NaN) vector is on the right and the variable vector on the left happens to contains a NaN, the ordered comparison will be false for that lane. Then the select will choose the constant from the right hand side rather than the NaN, so that scenario would not exhibit wasm's NaN propagation behavior.

tlively updated this revision to Diff 167401.Sep 27 2018, 2:03 PM
  • Rebase after splitting up D52450.
aheejin accepted this revision.Sep 28 2018, 2:06 PM
This revision is now accepted and ready to land.Sep 28 2018, 2:06 PM
tlively updated this revision to Diff 167879.Oct 1 2018, 8:03 PM
  • Rebase onto minimum/maximum intrinsic CLs
This revision was automatically updated to reflect the committed changes.