Skip to content

Commit f0ac5c9

Browse files
sayantnAmanieu
authored andcommitted
Fixed _mm256_cvtsd_f64
This intrinsic should have `target_feature` AVX, (according to Intel Intrinsics Guide) but had AVX2
1 parent 5c99f84 commit f0ac5c9

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

crates/core_arch/src/x86/avx.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,17 @@ pub unsafe fn _mm256_cvtps_pd(a: __m128) -> __m256d {
889889
simd_cast(a)
890890
}
891891

892+
/// Returns the first element of the input vector of `[4 x double]`.
893+
///
894+
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_cvtsd_f64)
895+
#[inline]
896+
#[target_feature(enable = "avx")]
897+
#[cfg_attr(test, assert_instr(vmovsd))]
898+
#[stable(feature = "simd_x86", since = "1.27.0")]
899+
pub unsafe fn _mm256_cvtsd_f64(a: __m256d) -> f64 {
900+
simd_extract!(a, 0)
901+
}
902+
892903
/// Converts packed double-precision (64-bit) floating-point elements in `a`
893904
/// to packed 32-bit integers with truncation.
894905
///
@@ -2937,7 +2948,7 @@ pub unsafe fn _mm256_storeu2_m128i(hiaddr: *mut __m128i, loaddr: *mut __m128i, a
29372948
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_cvtss_f32)
29382949
#[inline]
29392950
#[target_feature(enable = "avx")]
2940-
//#[cfg_attr(test, assert_instr(movss))] FIXME
2951+
#[cfg_attr(test, assert_instr(vmovss))]
29412952
#[stable(feature = "simd_x86", since = "1.27.0")]
29422953
pub unsafe fn _mm256_cvtss_f32(a: __m256) -> f32 {
29432954
simd_extract!(a, 0)
@@ -3640,6 +3651,13 @@ mod tests {
36403651
assert_eq_m256d(r, e);
36413652
}
36423653

3654+
#[simd_test(enable = "avx")]
3655+
unsafe fn test_mm256_cvtsd_f64() {
3656+
let a = _mm256_setr_pd(1., 2., 3., 4.);
3657+
let r = _mm256_cvtsd_f64(a);
3658+
assert_eq!(r, 1.);
3659+
}
3660+
36433661
#[simd_test(enable = "avx")]
36443662
unsafe fn test_mm256_cvttpd_epi32() {
36453663
let a = _mm256_setr_pd(4., 9., 16., 25.);

crates/core_arch/src/x86/avx2.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3625,17 +3625,6 @@ pub unsafe fn _mm256_extract_epi32<const INDEX: i32>(a: __m256i) -> i32 {
36253625
simd_extract!(a.as_i32x8(), INDEX as u32)
36263626
}
36273627

3628-
/// Returns the first element of the input vector of `[4 x double]`.
3629-
///
3630-
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_cvtsd_f64)
3631-
#[inline]
3632-
#[target_feature(enable = "avx2")]
3633-
//#[cfg_attr(test, assert_instr(movsd))] FIXME
3634-
#[stable(feature = "simd_x86", since = "1.27.0")]
3635-
pub unsafe fn _mm256_cvtsd_f64(a: __m256d) -> f64 {
3636-
simd_extract!(a, 0)
3637-
}
3638-
36393628
/// Returns the first element of the input vector of `[8 x i32]`.
36403629
///
36413630
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_cvtsi256_si32)
@@ -5776,13 +5765,6 @@ mod tests {
57765765
assert_eq!(r2, 3);
57775766
}
57785767

5779-
#[simd_test(enable = "avx2")]
5780-
unsafe fn test_mm256_cvtsd_f64() {
5781-
let a = _mm256_setr_pd(1., 2., 3., 4.);
5782-
let r = _mm256_cvtsd_f64(a);
5783-
assert_eq!(r, 1.);
5784-
}
5785-
57865768
#[simd_test(enable = "avx2")]
57875769
unsafe fn test_mm256_cvtsi256_si32() {
57885770
let a = _mm256_setr_epi32(1, 2, 3, 4, 5, 6, 7, 8);

0 commit comments

Comments
 (0)