Skip to content

Commit 7c2cab4

Browse files
bjorn3gnzlbg
authored andcommitted
Use simd_fma where possible
1 parent 1cbc39f commit 7c2cab4

File tree

1 file changed

+5
-4
lines changed
  • crates/core_arch/src/x86

1 file changed

+5
-4
lines changed

crates/core_arch/src/x86/fma.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
//! [wiki_fma]: https://en.wikipedia.org/wiki/Fused_multiply-accumulate
2020
2121
use crate::core_arch::x86::*;
22+
use crate::core_arch::simd_llvm::simd_fma;
2223

2324
#[cfg(test)]
2425
use stdarch_test::assert_instr;
@@ -32,7 +33,7 @@ use stdarch_test::assert_instr;
3233
#[cfg_attr(test, assert_instr(vfmadd))]
3334
#[stable(feature = "simd_x86", since = "1.27.0")]
3435
pub unsafe fn _mm_fmadd_pd(a: __m128d, b: __m128d, c: __m128d) -> __m128d {
35-
vfmaddpd(a, b, c)
36+
simd_fma(a, b, c)
3637
}
3738

3839
/// Multiplies packed double-precision (64-bit) floating-point elements in `a`
@@ -44,7 +45,7 @@ pub unsafe fn _mm_fmadd_pd(a: __m128d, b: __m128d, c: __m128d) -> __m128d {
4445
#[cfg_attr(test, assert_instr(vfmadd))]
4546
#[stable(feature = "simd_x86", since = "1.27.0")]
4647
pub unsafe fn _mm256_fmadd_pd(a: __m256d, b: __m256d, c: __m256d) -> __m256d {
47-
vfmaddpd256(a, b, c)
48+
simd_fma(a, b, c)
4849
}
4950

5051
/// Multiplies packed single-precision (32-bit) floating-point elements in `a`
@@ -56,7 +57,7 @@ pub unsafe fn _mm256_fmadd_pd(a: __m256d, b: __m256d, c: __m256d) -> __m256d {
5657
#[cfg_attr(test, assert_instr(vfmadd))]
5758
#[stable(feature = "simd_x86", since = "1.27.0")]
5859
pub unsafe fn _mm_fmadd_ps(a: __m128, b: __m128, c: __m128) -> __m128 {
59-
vfmaddps(a, b, c)
60+
simd_fma(a, b, c)
6061
}
6162

6263
/// Multiplies packed single-precision (32-bit) floating-point elements in `a`
@@ -68,7 +69,7 @@ pub unsafe fn _mm_fmadd_ps(a: __m128, b: __m128, c: __m128) -> __m128 {
6869
#[cfg_attr(test, assert_instr(vfmadd))]
6970
#[stable(feature = "simd_x86", since = "1.27.0")]
7071
pub unsafe fn _mm256_fmadd_ps(a: __m256, b: __m256, c: __m256) -> __m256 {
71-
vfmaddps256(a, b, c)
72+
simd_fma(a, b, c)
7273
}
7374

7475
/// Multiplies the lower double-precision (64-bit) floating-point elements in

0 commit comments

Comments
 (0)