[PATCH] D142859: [PoC][AArch64] Inline math function (SVE sin/cos)

KAWASHIMA Takahiro via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 29 18:19:14 PST 2023


kawashima-fj created this revision.
Herald added subscribers: ctetreau, hiraditya, kristof.beyls, tschuett.
Herald added a project: All.
kawashima-fj requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead.
Herald added a project: LLVM.

**DO NOT REVIEW; For reference only.**

The Arm A64 instruction set has instructions dedicated to some mathematical functions. This patch expands `llvm.sin.*` and `llvm.cos.*` intrinsics using these instructions when the fast-math flag `afn` is attached and SVE can be used.

This can improve performance in terms of followings.

- Utilize optimal dedicated instructions based on the target architecture feature (SVE, NEON) (can be achieved also by dedicated math libraries)
- Vectorize loops which include mathematical function calls (can be achieved also by vectorized math libraries and compiler support, e.g. D134719 <https://reviews.llvm.org/D134719>)
- Eliminate function call overhead
- Schedule instructions in caller and callee collectively
- Better software pipelining (in the future)
- Increase optimal candidates of fission points in loop fission (in the future)

This patch is a primitive work. I posted here to discuss direction of this patch at Discourse. A complete patch will be posted in another review.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142859

Files:
  llvm/include/llvm/IR/IntrinsicsAArch64.td
  llvm/lib/Target/AArch64/AArch64.h
  llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
  llvm/lib/Target/AArch64/AArch64InlineMathPass.cpp
  llvm/lib/Target/AArch64/AArch64InlineMathSymbols.h
  llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
  llvm/lib/Target/AArch64/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142859.493175.patch
Type: text/x-patch
Size: 34145 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230130/9960b47e/attachment.bin>


More information about the llvm-commits mailing list