diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /third_party/rust/packed_simd/src/codegen/llvm.rs | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/packed_simd/src/codegen/llvm.rs')
-rw-r--r-- | third_party/rust/packed_simd/src/codegen/llvm.rs | 107 |
1 files changed, 107 insertions, 0 deletions
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<T, U>(x: T, y: T, idx: [u32; 2]) -> U + where + T: Simd, + <T as Simd>::Element: Shuffle<[u32; 2], Output = U>; + + #[rustc_args_required_const(2)] + pub fn simd_shuffle4<T, U>(x: T, y: T, idx: [u32; 4]) -> U + where + T: Simd, + <T as Simd>::Element: Shuffle<[u32; 4], Output = U>; + + #[rustc_args_required_const(2)] + pub fn simd_shuffle8<T, U>(x: T, y: T, idx: [u32; 8]) -> U + where + T: Simd, + <T as Simd>::Element: Shuffle<[u32; 8], Output = U>; + + #[rustc_args_required_const(2)] + pub fn simd_shuffle16<T, U>(x: T, y: T, idx: [u32; 16]) -> U + where + T: Simd, + <T as Simd>::Element: Shuffle<[u32; 16], Output = U>; + + #[rustc_args_required_const(2)] + pub fn simd_shuffle32<T, U>(x: T, y: T, idx: [u32; 32]) -> U + where + T: Simd, + <T as Simd>::Element: Shuffle<[u32; 32], Output = U>; + + #[rustc_args_required_const(2)] + pub fn simd_shuffle64<T, U>(x: T, y: T, idx: [u32; 64]) -> U + where + T: Simd, + <T as 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<T, U>(x: T, y: T) -> U; + crate fn simd_ne<T, U>(x: T, y: T) -> U; + crate fn simd_lt<T, U>(x: T, y: T) -> U; + crate fn simd_le<T, U>(x: T, y: T) -> U; + crate fn simd_gt<T, U>(x: T, y: T) -> U; + crate fn simd_ge<T, U>(x: T, y: T) -> U; + + crate fn simd_insert<T, U>(x: T, idx: u32, val: U) -> T; + crate fn simd_extract<T, U>(x: T, idx: u32) -> U; + + crate fn simd_cast<T, U>(x: T) -> U; + + crate fn simd_add<T>(x: T, y: T) -> T; + crate fn simd_sub<T>(x: T, y: T) -> T; + crate fn simd_mul<T>(x: T, y: T) -> T; + crate fn simd_div<T>(x: T, y: T) -> T; + crate fn simd_rem<T>(x: T, y: T) -> T; + crate fn simd_shl<T>(x: T, y: T) -> T; + crate fn simd_shr<T>(x: T, y: T) -> T; + crate fn simd_and<T>(x: T, y: T) -> T; + crate fn simd_or<T>(x: T, y: T) -> T; + crate fn simd_xor<T>(x: T, y: T) -> T; + + crate fn simd_reduce_add_unordered<T, U>(x: T) -> U; + crate fn simd_reduce_mul_unordered<T, U>(x: T) -> U; + crate fn simd_reduce_add_ordered<T, U>(x: T, acc: U) -> U; + crate fn simd_reduce_mul_ordered<T, U>(x: T, acc: U) -> U; + crate fn simd_reduce_min<T, U>(x: T) -> U; + crate fn simd_reduce_max<T, U>(x: T) -> U; + crate fn simd_reduce_min_nanless<T, U>(x: T) -> U; + crate fn simd_reduce_max_nanless<T, U>(x: T) -> U; + crate fn simd_reduce_and<T, U>(x: T) -> U; + crate fn simd_reduce_or<T, U>(x: T) -> U; + crate fn simd_reduce_xor<T, U>(x: T) -> U; + crate fn simd_reduce_all<T>(x: T) -> bool; + crate fn simd_reduce_any<T>(x: T) -> bool; + + crate fn simd_select<M, T>(m: M, a: T, b: T) -> T; + + crate fn simd_fmin<T>(a: T, b: T) -> T; + crate fn simd_fmax<T>(a: T, b: T) -> T; + + crate fn simd_fsqrt<T>(a: T) -> T; + crate fn simd_fma<T>(a: T, b: T, c: T) -> T; + + crate fn simd_gather<T, P, M>(value: T, pointers: P, mask: M) -> T; + crate fn simd_scatter<T, P, M>(value: T, pointers: P, mask: M); + + crate fn simd_bitmask<T, U>(value: T) -> U; +} |