[PATCH] D53685: [WebAssembly] Bitselect and min/max builtins

Thomas Lively via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 24 20:22:58 PDT 2018


tlively added inline comments.


================
Comment at: include/clang/Basic/BuiltinsWebAssembly.def:85
 
+BUILTIN(__builtin_wasm_bitselect, "V4iV4iV4iV4i", "nc")
+
----------------
aheejin wrote:
> Do you think we need to provide this builtin also for other vector types?
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).


Repository:
  rC Clang

https://reviews.llvm.org/D53685





More information about the cfe-commits mailing list