This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Bitselect and min/max builtins
ClosedPublic

Authored by tlively on Oct 24 2018, 6:38 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

tlively created this revision.Oct 24 2018, 6:38 PM
tlively retitled this revision from [WebAssembly] Bitselect and min/max intrinsics to [WebAssembly] Bitselect and min/max builtins.Oct 24 2018, 6:48 PM
aheejin added inline comments.Oct 24 2018, 7:42 PM
include/clang/Basic/BuiltinsWebAssembly.def
85 ↗(On Diff #171030)

Do you think we need to provide this builtin also for other vector types?

tlively added inline comments.Oct 24 2018, 8:22 PM
include/clang/Basic/BuiltinsWebAssembly.def
85 ↗(On Diff #171030)

This builtin is interesting because there is basically no reason for the mask to be the same type as the vectors. So we could have 36 versions of this, one for each pair of vector types. Or if we required the mask to be a vector of integers we could cut that down to just 24 versions. But no matter what types you use, this builtin does the exact same thing to the bits. So in the end it seems simpler to have just one version and have users convert between vector types. Without the -fno-lax-vector-conversions flag, clang will silently convert between vector types for you anyway, so there's no real ergonomic loss either (not that ergonomics really matter for builtins).

aheejin accepted this revision.Oct 25 2018, 12:10 PM
This revision is now accepted and ready to land.Oct 25 2018, 12:10 PM
This revision was automatically updated to reflect the committed changes.