use mem::transmute;
use simd::*;
pub struct Round(i32);
impl Round {
pub fn nearest() -> Self {
Round(::arch::_MM_FROUND_TO_NEAREST_INT)
}
pub fn down() -> Self {
Round(::arch::_MM_FROUND_TO_NEG_INF)
}
pub fn up() -> Self {
Round(::arch::_MM_FROUND_TO_POS_INF)
}
pub fn zero() -> Self {
Round(::arch::_MM_FROUND_TO_ZERO)
}
pub fn current() -> Self {
Round(::arch::_MM_FROUND_CUR_DIRECTION)
}
pub fn floor() -> Self {
Round(::arch::_MM_FROUND_FLOOR)
}
pub fn ceil() -> Self {
Round(::arch::_MM_FROUND_CEIL)
}
pub fn trunc() -> Self {
Round(::arch::_MM_FROUND_TRUNC)
}
pub fn rint() -> Self {
Round(::arch::_MM_FROUND_RINT)
}
pub fn nearby_int() -> Self {
Round(::arch::_MM_FROUND_NEARBYINT)
}
#[must_use = "this operation returns a new value"]
pub fn supress_exceptions(self) -> Round {
Round(self.0 | ::arch::_MM_FROUND_NO_EXC)
}
#[must_use = "this operation returns a new value"]
pub fn raise_exceptions(self) -> Round {
Round(self.0 | ::arch::_MM_FROUND_RAISE_EXC)
}
}
#[inline]
#[target_feature(enable = "sse4.1")]
pub unsafe fn _mm_blendv_epi8(
a: i8x16,
b: i8x16,
mask: i8x16, ) -> i8x16 {
transmute(::arch::_mm_blendv_epi8(
transmute(a),
transmute(b),
transmute(mask),
))
}
#[target_feature(enable = "sse4.1")]
pub unsafe fn _mm_round_ps(a: f32x4, rounding: Round) -> f32x4 {
let a = transmute(a);
macro_rules! call {
($i:expr) => {
::arch::_mm_round_ps(a, $i)
};
}
let v = constify_imm4!(rounding.0, call);
transmute(v)
}
#[inline]
#[target_feature(enable = "sse4.1")]
pub unsafe fn _mm_ceil_ps(a: f32x4) -> f32x4 {
transmute(::arch::_mm_ceil_ps(transmute(a)))
}
#[inline]
#[target_feature(enable = "sse4.1")]
pub unsafe fn _mm_floor_ps(a: f32x4) -> f32x4 {
transmute(::arch::_mm_floor_ps(transmute(a)))
}
#[inline]
#[target_feature(enable = "sse4.1")]
pub unsafe fn _mm_cvtepu8_epi16(a: u8x16) -> i16x8 {
transmute(::arch::_mm_cvtepu8_epi16(transmute(a)))
}