Use simd_floor and simd_ceil where possible

This commit is contained in:
bjorn3 2019-07-31 11:31:02 +02:00 committed by gnzlbg
parent 1ac2f13d76
commit 8c643df017
2 changed files with 6 additions and 4 deletions

View file

@ -61,5 +61,7 @@ extern "platform-intrinsic" {
pub fn simd_fmax<T>(a: T, b: T) -> T;
pub fn simd_fsqrt<T>(a: T) -> T;
pub fn simd_floor<T>(a: T) -> T;
pub fn simd_ceil<T>(a: T) -> T;
pub fn simd_fma<T>(a: T, b: T, c: T) -> T;
}

View file

@ -426,7 +426,7 @@ pub unsafe fn _mm256_round_pd(a: __m256d, b: i32) -> __m256d {
#[cfg_attr(test, assert_instr(vroundpd))]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm256_ceil_pd(a: __m256d) -> __m256d {
roundpd256(a, 0x02)
simd_ceil(a)
}
/// Rounds packed double-precision (64-bit) floating point elements in `a`
@ -438,7 +438,7 @@ pub unsafe fn _mm256_ceil_pd(a: __m256d) -> __m256d {
#[cfg_attr(test, assert_instr(vroundpd))]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm256_floor_pd(a: __m256d) -> __m256d {
roundpd256(a, 0x01)
simd_floor(a)
}
/// Rounds packed single-precision (32-bit) floating point elements in `a`
@ -477,7 +477,7 @@ pub unsafe fn _mm256_round_ps(a: __m256, b: i32) -> __m256 {
#[cfg_attr(test, assert_instr(vroundps))]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm256_ceil_ps(a: __m256) -> __m256 {
roundps256(a, 0x02)
simd_ceil(a)
}
/// Rounds packed single-precision (32-bit) floating point elements in `a`
@ -489,7 +489,7 @@ pub unsafe fn _mm256_ceil_ps(a: __m256) -> __m256 {
#[cfg_attr(test, assert_instr(vroundps))]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm256_floor_ps(a: __m256) -> __m256 {
roundps256(a, 0x01)
simd_floor(a)
}
/// Returns the square root of packed single-precision (32-bit) floating point