[PATCH] D101112: [WebAssembly] Finalize wasm_simd128.h intrinsics

Heejin Ahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 22 17:25:51 PDT 2021


aheejin added a comment.

General question about SIMD intrinsics: So we make dedicated wasm intrinsics only for the cases there are not general intrinsics people can use instead?



================
Comment at: clang/lib/Headers/wasm_simd128.h:171
+
+#define wasm_v128_load8_lane(__ptr, __vec, __i)                                \
+  ((v128_t)__builtin_wasm_load8_lane((signed char *)(__ptr), (__i8x16)(__vec), \
----------------
dschuff wrote:
> out of curiosity, why are these macros, while all the rest (including ones that don't need declarations such as `wasm_i64x2_eq`) seem to be inline functions?
I was also curious about this too.


================
Comment at: clang/lib/Headers/wasm_simd128.h:648
+static __inline__ bool __DEFAULT_FN_ATTRS wasm_v128_any_true(v128_t __a) {
+  return __builtin_wasm_any_true_i8x16((__i8x16)__a);
+}
----------------
Do we not rename the builtin to `v128` as well?


================
Comment at: clang/lib/Headers/wasm_simd128.h:969
+static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_ceil(v128_t __a) {
+  return (v128_t)__builtin_wasm_ceil_f32x4((__f32x4)__a);
+}
----------------
Sometimes builtin names seem slightly different from intrinsic names like this case: the intrinsic name is `f32x4_ceil` while the builtin name is `ceil_f32x4`. Is that intentional?


================
Comment at: clang/lib/Headers/wasm_simd128.h:1389
+
+// Old intrinsic names supported to ease transitioning to the stand names. Do
+// not use these; they will be removed in the near future.
----------------



================
Comment at: clang/lib/Headers/wasm_simd128.h:1398
+
+#ifdef __DEPRECATED
+#define __DEPRECATED_WASM_MACRO(__name, __replacement)                         \
----------------
What does this macro do?


================
Comment at: clang/lib/Headers/wasm_simd128.h:1547
+static __inline__ v128_t __DEPRECATED_FN_ATTRS("wasm_u16x8_extend_low_u8x16")
+wasm_i16x8_widen_low_u8x16(v128_t __a) {
+  return wasm_u16x8_extend_low_u8x16(__a);
----------------
The deprecated function name and the new intrinsic say `u`. Should this be `u` too? I haven't checked every single entry, but there seem to be multiple instances like this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101112/new/

https://reviews.llvm.org/D101112



More information about the cfe-commits mailing list