Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import LLVM SIMD intrinsics from core rather than declaring them locally #1529

Merged
merged 1 commit into from
Feb 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 5 additions & 65 deletions crates/core_arch/src/simd_llvm.rs
Original file line number Diff line number Diff line change
@@ -1,76 +1,16 @@
//! LLVM's SIMD platform intrinsics

extern "platform-intrinsic" {
//pub fn simd_select_bitmask
pub fn simd_eq<T, U>(x: T, y: T) -> U;
pub fn simd_ne<T, U>(x: T, y: T) -> U;
pub fn simd_lt<T, U>(x: T, y: T) -> U;
pub fn simd_le<T, U>(x: T, y: T) -> U;
pub fn simd_gt<T, U>(x: T, y: T) -> U;
pub fn simd_ge<T, U>(x: T, y: T) -> U;

pub fn simd_shuffle<T, U, V>(x: T, y: T, idx: U) -> V;
// This re-export is temporary; once libcore has all the required intrinsics, we can
// remove this entire file.
#[allow(unused_imports)]
pub use crate::intrinsics::simd::*;

extern "platform-intrinsic" {
#[rustc_const_unstable(feature = "const_simd_insert", issue = "none")]
pub fn simd_insert<T, U>(x: T, idx: u32, val: U) -> T;
#[rustc_const_unstable(feature = "const_simd_extract", issue = "none")]
pub fn simd_extract<T, U>(x: T, idx: u32) -> U;
//pub fn simd_select
pub fn simd_bitmask<T, U>(x: T) -> U;

pub fn simd_cast<T, U>(x: T) -> U;

pub fn simd_add<T>(x: T, y: T) -> T;
pub fn simd_sub<T>(x: T, y: T) -> T;
pub fn simd_mul<T>(x: T, y: T) -> T;
pub fn simd_div<T>(x: T, y: T) -> T;
pub fn simd_rem<T>(x: T, y: T) -> T;
pub fn simd_shl<T>(x: T, y: T) -> T;
pub fn simd_shr<T>(x: T, y: T) -> T;
pub fn simd_and<T>(x: T, y: T) -> T;
pub fn simd_or<T>(x: T, y: T) -> T;
pub fn simd_xor<T>(x: T, y: T) -> T;

pub fn simd_neg<T>(x: T) -> T;

pub fn simd_saturating_add<T>(x: T, y: T) -> T;
pub fn simd_saturating_sub<T>(x: T, y: T) -> T;

pub fn simd_gather<T, U, V>(values: T, pointers: U, mask: V) -> T;
pub fn simd_scatter<T, U, V>(values: T, pointers: U, mask: V);

pub fn simd_reduce_add_unordered<T, U>(x: T) -> U;
pub fn simd_reduce_mul_unordered<T, U>(x: T) -> U;
pub fn simd_reduce_add_ordered<T, U>(x: T, acc: U) -> U;
pub fn simd_reduce_mul_ordered<T, U>(x: T, acc: U) -> U;
pub fn simd_reduce_min<T, U>(x: T) -> U;
pub fn simd_reduce_max<T, U>(x: T) -> U;
pub fn simd_reduce_min_nanless<T, U>(x: T) -> U;
pub fn simd_reduce_max_nanless<T, U>(x: T) -> U;
pub fn simd_reduce_and<T, U>(x: T) -> U;
pub fn simd_reduce_or<T, U>(x: T) -> U;
pub fn simd_reduce_xor<T, U>(x: T) -> U;
pub fn simd_reduce_all<T>(x: T) -> bool;
pub fn simd_reduce_any<T>(x: T) -> bool;

pub fn simd_select<M, T>(m: M, a: T, b: T) -> T;
pub fn simd_select_bitmask<M, T>(m: M, a: T, b: T) -> T;

pub fn simd_fmin<T>(a: T, b: T) -> T;
pub fn simd_fmax<T>(a: T, b: T) -> T;

pub fn simd_fsqrt<T>(a: T) -> T;
pub fn simd_fsin<T>(a: T) -> T;
pub fn simd_fcos<T>(a: T) -> T;
pub fn simd_fabs<T>(a: T) -> T;
pub fn simd_floor<T>(a: T) -> T;
pub fn simd_ceil<T>(a: T) -> T;
pub fn simd_fexp<T>(a: T) -> T;
pub fn simd_fexp2<T>(a: T) -> T;
pub fn simd_flog10<T>(a: T) -> T;
pub fn simd_flog2<T>(a: T) -> T;
pub fn simd_flog<T>(a: T) -> T;
//pub fn simd_fpowi
//pub fn simd_fpow
pub fn simd_fma<T>(a: T, b: T, c: T) -> T;
}