//! This module contains the LLVM intrinsics bindings that provide the functionality for this //! crate. //! //! The LLVM assembly language is documented here: /// These intrinsics aren't linked directly from LLVM and are mostly undocumented, however they are /// simply lowered to the matching LLVM instructions by the compiler. The associated instruction /// is documented alongside each intrinsic. extern "platform-intrinsic" { /// add/fadd pub(crate) fn simd_add(x: T, y: T) -> T; /// sub/fsub pub(crate) fn simd_sub(x: T, y: T) -> T; /// mul/fmul pub(crate) fn simd_mul(x: T, y: T) -> T; /// udiv/sdiv/fdiv pub(crate) fn simd_div(x: T, y: T) -> T; /// urem/srem/frem pub(crate) fn simd_rem(x: T, y: T) -> T; /// shl pub(crate) fn simd_shl(x: T, y: T) -> T; /// lshr/ashr pub(crate) fn simd_shr(x: T, y: T) -> T; /// and pub(crate) fn simd_and(x: T, y: T) -> T; /// or pub(crate) fn simd_or(x: T, y: T) -> T; /// xor pub(crate) fn simd_xor(x: T, y: T) -> T; /// fptoui/fptosi/uitofp/sitofp pub(crate) fn simd_cast(x: T) -> U; /// neg/fneg pub(crate) fn simd_neg(x: T) -> T; /// fabs pub(crate) fn simd_fabs(x: T) -> T; pub(crate) fn simd_eq(x: T, y: T) -> U; pub(crate) fn simd_ne(x: T, y: T) -> U; pub(crate) fn simd_lt(x: T, y: T) -> U; pub(crate) fn simd_le(x: T, y: T) -> U; pub(crate) fn simd_gt(x: T, y: T) -> U; pub(crate) fn simd_ge(x: T, y: T) -> U; // shufflevector pub(crate) fn simd_shuffle(x: T, y: T, idx: U) -> V; pub(crate) fn simd_gather(val: T, ptr: U, mask: V) -> T; pub(crate) fn simd_scatter(val: T, ptr: U, mask: V); // {s,u}add.sat pub(crate) fn simd_saturating_add(x: T, y: T) -> T; // {s,u}sub.sat pub(crate) fn simd_saturating_sub(x: T, y: T) -> T; // reductions pub(crate) fn simd_reduce_add_ordered(x: T, y: U) -> U; pub(crate) fn simd_reduce_mul_ordered(x: T, y: U) -> U; #[allow(unused)] pub(crate) fn simd_reduce_all(x: T) -> bool; #[allow(unused)] pub(crate) fn simd_reduce_any(x: T) -> bool; pub(crate) fn simd_reduce_max(x: T) -> U; pub(crate) fn simd_reduce_min(x: T) -> U; pub(crate) fn simd_reduce_and(x: T) -> U; pub(crate) fn simd_reduce_or(x: T) -> U; pub(crate) fn simd_reduce_xor(x: T) -> U; // truncate integer vector to bitmask #[allow(unused)] pub(crate) fn simd_bitmask(x: T) -> U; // select pub(crate) fn simd_select(m: M, a: T, b: T) -> T; #[allow(unused)] pub(crate) fn simd_select_bitmask(m: M, a: T, b: T) -> T; } #[cfg(feature = "std")] mod std { extern "platform-intrinsic" { // ceil pub(crate) fn simd_ceil(x: T) -> T; // floor pub(crate) fn simd_floor(x: T) -> T; // round pub(crate) fn simd_round(x: T) -> T; // trunc pub(crate) fn simd_trunc(x: T) -> T; // fsqrt pub(crate) fn simd_fsqrt(x: T) -> T; // fma pub(crate) fn simd_fma(x: T, y: T, z: T) -> T; } } #[cfg(feature = "std")] pub(crate) use crate::simd::intrinsics::std::*;