[PATCH] D102018: [WebAssembly] Use functions instead of macros for const SIMD intrinsics

Heejin Ahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 7 00:33:56 PDT 2021


aheejin accepted this revision.
aheejin added a comment.
This revision is now accepted and ready to land.

> To improve hygiene, consistency, and usability, it would be good to replace all
> the macro intrinsics in wasm_simd128.h with functions. The reason for using
> macros in the first place was to enforce the use of constants for some arguments
> using `_Static_assert` with `__builtin_constant_p`. This commit switches to
> using functions and uses the `__diagnose_if__` attribute rather than
> `_Static_assert` to enforce constantness.

So what prevented us from using functions when we were using `_Static_assert` and why is it now possible to use functions?

> The remaining macro intrinsics cannot be made into functions until the builtin
> functions they are implemented with can be replaced with normal code patterns
> because the builtin functions themselves require that their arguments are
> constants.

Why can't we also use `__REQUIRE_CONSTANT` there? Can't we call `__REQUIRE_CONSTANT` before we call builtins within intrinsic functions?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102018



More information about the cfe-commits mailing list