<div dir="auto">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.<div dir="auto"><br></div><div dir="auto">Tracking issue for vector math library with more details:</div><div dir="auto"><a href="https://github.com/rust-lang/stdsimd/issues/109">https://github.com/rust-lang/stdsimd/issues/109</a><br></div><div dir="auto"><br></div><div dir="auto">WIP vector math library:</div><div dir="auto"><a href="https://salsa.debian.org/Kazan-team/vector-math/">https://salsa.debian.org/Kazan-team/vector-math/</a><br></div><div dir="auto"><br></div><div dir="auto">What all is required to get LLVM to generate libcalls to our vector math library? Does this sound like a good plan?</div><div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br></div><div dir="auto">Jacob Lifshay</div></div>