[llvm-dev] Adding libcall support for Rust's new vector math library

Jacob Lifshay via llvm-dev llvm-dev at lists.llvm.org
Mon Jun 7 19:19:15 PDT 2021

We're writing a vector math library for use with Rust's Project Portable
SIMD, where we would like to have fast architecture-independent
implementations of functions like vectorized cos that are available from
Rust's `core` library, where the requirement is that it can't depend on
system libraries such as libc or libm. In order to have Rust code run as
fast as possible, we want to have the Rust compiler generate calls to LLVM
intrinsics such as llvm.cos.v4f32 allowing LLVM to optimize those
intrinsics and generate native instructions where available, otherwise
generating calls to the Rust vector math library functions that implement
the appropriate functions.

Tracking issue for vector math library with more details:

WIP vector math library:

What all is required to get LLVM to generate libcalls to our vector math
library? Does this sound like a good plan?

Also, there are some math functions that don't currently have generic LLVM
intrinsics, that several different architectures support, such as sinpi
which is supported by AMDGPU (multiply input by 0.5 then use the `sin`
instruction), OpenCL-flavored SPIR-V, Libre-SOC's SimpleV (not in LLVM
yet), and probably others too.

Jacob Lifshay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210607/1b7cba2d/attachment.html>

More information about the llvm-dev mailing list