From 2aa4a82499d4becd2284cdb482213d541b8804dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 16:29:10 +0200 Subject: Adding upstream version 86.0.1. Signed-off-by: Daniel Baumann --- third_party/rust/packed_simd/src/codegen/llvm.rs | 107 +++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 third_party/rust/packed_simd/src/codegen/llvm.rs (limited to 'third_party/rust/packed_simd/src/codegen/llvm.rs') diff --git a/third_party/rust/packed_simd/src/codegen/llvm.rs b/third_party/rust/packed_simd/src/codegen/llvm.rs new file mode 100644 index 0000000000..93c6ce6b77 --- /dev/null +++ b/third_party/rust/packed_simd/src/codegen/llvm.rs @@ -0,0 +1,107 @@ +//! LLVM's platform intrinsics +#![allow(dead_code)] + +use crate::sealed::Shuffle; +#[allow(unused_imports)] // FIXME: spurious warning? +use crate::sealed::Simd; + +// Shuffle intrinsics: expanded in users' crates, therefore public. +extern "platform-intrinsic" { + // FIXME: Passing this intrinsics an `idx` array with an index that is + // out-of-bounds will produce a monomorphization-time error. + // https://github.com/rust-lang-nursery/packed_simd/issues/21 + #[rustc_args_required_const(2)] + pub fn simd_shuffle2(x: T, y: T, idx: [u32; 2]) -> U + where + T: Simd, + ::Element: Shuffle<[u32; 2], Output = U>; + + #[rustc_args_required_const(2)] + pub fn simd_shuffle4(x: T, y: T, idx: [u32; 4]) -> U + where + T: Simd, + ::Element: Shuffle<[u32; 4], Output = U>; + + #[rustc_args_required_const(2)] + pub fn simd_shuffle8(x: T, y: T, idx: [u32; 8]) -> U + where + T: Simd, + ::Element: Shuffle<[u32; 8], Output = U>; + + #[rustc_args_required_const(2)] + pub fn simd_shuffle16(x: T, y: T, idx: [u32; 16]) -> U + where + T: Simd, + ::Element: Shuffle<[u32; 16], Output = U>; + + #[rustc_args_required_const(2)] + pub fn simd_shuffle32(x: T, y: T, idx: [u32; 32]) -> U + where + T: Simd, + ::Element: Shuffle<[u32; 32], Output = U>; + + #[rustc_args_required_const(2)] + pub fn simd_shuffle64(x: T, y: T, idx: [u32; 64]) -> U + where + T: Simd, + ::Element: Shuffle<[u32; 64], Output = U>; +} + +pub use self::simd_shuffle16 as __shuffle_vector16; +pub use self::simd_shuffle2 as __shuffle_vector2; +pub use self::simd_shuffle32 as __shuffle_vector32; +pub use self::simd_shuffle4 as __shuffle_vector4; +pub use self::simd_shuffle64 as __shuffle_vector64; +pub use self::simd_shuffle8 as __shuffle_vector8; + +extern "platform-intrinsic" { + crate fn simd_eq(x: T, y: T) -> U; + crate fn simd_ne(x: T, y: T) -> U; + crate fn simd_lt(x: T, y: T) -> U; + crate fn simd_le(x: T, y: T) -> U; + crate fn simd_gt(x: T, y: T) -> U; + crate fn simd_ge(x: T, y: T) -> U; + + crate fn simd_insert(x: T, idx: u32, val: U) -> T; + crate fn simd_extract(x: T, idx: u32) -> U; + + crate fn simd_cast(x: T) -> U; + + crate fn simd_add(x: T, y: T) -> T; + crate fn simd_sub(x: T, y: T) -> T; + crate fn simd_mul(x: T, y: T) -> T; + crate fn simd_div(x: T, y: T) -> T; + crate fn simd_rem(x: T, y: T) -> T; + crate fn simd_shl(x: T, y: T) -> T; + crate fn simd_shr(x: T, y: T) -> T; + crate fn simd_and(x: T, y: T) -> T; + crate fn simd_or(x: T, y: T) -> T; + crate fn simd_xor(x: T, y: T) -> T; + + crate fn simd_reduce_add_unordered(x: T) -> U; + crate fn simd_reduce_mul_unordered(x: T) -> U; + crate fn simd_reduce_add_ordered(x: T, acc: U) -> U; + crate fn simd_reduce_mul_ordered(x: T, acc: U) -> U; + crate fn simd_reduce_min(x: T) -> U; + crate fn simd_reduce_max(x: T) -> U; + crate fn simd_reduce_min_nanless(x: T) -> U; + crate fn simd_reduce_max_nanless(x: T) -> U; + crate fn simd_reduce_and(x: T) -> U; + crate fn simd_reduce_or(x: T) -> U; + crate fn simd_reduce_xor(x: T) -> U; + crate fn simd_reduce_all(x: T) -> bool; + crate fn simd_reduce_any(x: T) -> bool; + + crate fn simd_select(m: M, a: T, b: T) -> T; + + crate fn simd_fmin(a: T, b: T) -> T; + crate fn simd_fmax(a: T, b: T) -> T; + + crate fn simd_fsqrt(a: T) -> T; + crate fn simd_fma(a: T, b: T, c: T) -> T; + + crate fn simd_gather(value: T, pointers: P, mask: M) -> T; + crate fn simd_scatter(value: T, pointers: P, mask: M); + + crate fn simd_bitmask(value: T) -> U; +} -- cgit v1.2.3