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

Thomas Lively via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 6 13:07:06 PDT 2021


tlively created this revision.
tlively added a reviewer: aheejin.
Herald added subscribers: wingo, ecnelises, sunfish, jgravelle-google, sbc100, dschuff.
tlively requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102018

Files:
  clang/lib/Headers/wasm_simd128.h
  clang/test/Headers/wasm.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102018.343484.patch
Type: text/x-patch
Size: 10907 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210506/31038b4e/attachment-0001.bin>


More information about the cfe-commits mailing list