[PATCH] D71648: [WebAssembly] Add avgr_u intrinsics and require nuw in patterns

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 22:03:14 PST 2019


tlively created this revision.
tlively added a reviewer: aheejin.
Herald added subscribers: llvm-commits, cfe-commits, sunfish, hiraditya, jgravelle-google, sbc100, dschuff.
Herald added projects: clang, LLVM.

The vector pattern `(a + b + 1) / 2` was previously selected to an
avgr_u instruction regardless of nuw flags, but this is incorrect in
the case where either addition may have an unsigned wrap. This CL
changes the existing pattern to require both adds to have nuw flags
and adds builtin functions and intrinsics for the avgr_u instructions
because the corrected pattern is not representable in C.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71648

Files:
  clang/include/clang/Basic/BuiltinsWebAssembly.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/builtins-wasm.c
  llvm/include/llvm/IR/IntrinsicsWebAssembly.td
  llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td
  llvm/test/CodeGen/WebAssembly/simd-arith.ll
  llvm/test/CodeGen/WebAssembly/simd-intrinsics.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71648.234462.patch
Type: text/x-patch
Size: 8294 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191218/be4dd823/attachment.bin>


More information about the llvm-commits mailing list