Skip to content

Commit 1d311c9

Browse files
TDeckingAmanieu
authored andcommitted
Update sse.rs
1 parent a5c75dc commit 1d311c9

File tree

1 file changed

+6
-18
lines changed
  • crates/core_arch/src/x86

1 file changed

+6
-18
lines changed

crates/core_arch/src/x86/sse.rs

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use stdarch_test::assert_instr;
1818
#[cfg_attr(test, assert_instr(addss))]
1919
#[stable(feature = "simd_x86", since = "1.27.0")]
2020
pub unsafe fn _mm_add_ss(a: __m128, b: __m128) -> __m128 {
21-
addss(a, b)
21+
simd_insert!(a, 0, _mm_cvtss_f32(a) + _mm_cvtss_f32(b))
2222
}
2323

2424
/// Adds __m128 vectors.
@@ -41,7 +41,7 @@ pub unsafe fn _mm_add_ps(a: __m128, b: __m128) -> __m128 {
4141
#[cfg_attr(test, assert_instr(subss))]
4242
#[stable(feature = "simd_x86", since = "1.27.0")]
4343
pub unsafe fn _mm_sub_ss(a: __m128, b: __m128) -> __m128 {
44-
subss(a, b)
44+
simd_insert!(a, 0, _mm_cvtss_f32(a) - _mm_cvtss_f32(b))
4545
}
4646

4747
/// Subtracts __m128 vectors.
@@ -64,7 +64,7 @@ pub unsafe fn _mm_sub_ps(a: __m128, b: __m128) -> __m128 {
6464
#[cfg_attr(test, assert_instr(mulss))]
6565
#[stable(feature = "simd_x86", since = "1.27.0")]
6666
pub unsafe fn _mm_mul_ss(a: __m128, b: __m128) -> __m128 {
67-
mulss(a, b)
67+
simd_insert!(a, 0, _mm_cvtss_f32(a) * _mm_cvtss_f32(b))
6868
}
6969

7070
/// Multiplies __m128 vectors.
@@ -87,7 +87,7 @@ pub unsafe fn _mm_mul_ps(a: __m128, b: __m128) -> __m128 {
8787
#[cfg_attr(test, assert_instr(divss))]
8888
#[stable(feature = "simd_x86", since = "1.27.0")]
8989
pub unsafe fn _mm_div_ss(a: __m128, b: __m128) -> __m128 {
90-
divss(a, b)
90+
simd_insert!(a, 0, _mm_cvtss_f32(a) / _mm_cvtss_f32(b))
9191
}
9292

9393
/// Divides __m128 vectors.
@@ -110,7 +110,7 @@ pub unsafe fn _mm_div_ps(a: __m128, b: __m128) -> __m128 {
110110
#[cfg_attr(test, assert_instr(sqrtss))]
111111
#[stable(feature = "simd_x86", since = "1.27.0")]
112112
pub unsafe fn _mm_sqrt_ss(a: __m128) -> __m128 {
113-
sqrtss(a)
113+
simd_insert!(a, 0, _mm_cvtss_f32(a).sqrt())
114114
}
115115

116116
/// Returns the square root of packed single-precision (32-bit) floating-point
@@ -122,7 +122,7 @@ pub unsafe fn _mm_sqrt_ss(a: __m128) -> __m128 {
122122
#[cfg_attr(test, assert_instr(sqrtps))]
123123
#[stable(feature = "simd_x86", since = "1.27.0")]
124124
pub unsafe fn _mm_sqrt_ps(a: __m128) -> __m128 {
125-
sqrtps(a)
125+
simd_fsqrt(a)
126126
}
127127

128128
/// Returns the approximate reciprocal of the first single-precision
@@ -1920,18 +1920,6 @@ pub unsafe fn _MM_TRANSPOSE4_PS(
19201920

19211921
#[allow(improper_ctypes)]
19221922
extern "C" {
1923-
#[link_name = "llvm.x86.sse.add.ss"]
1924-
fn addss(a: __m128, b: __m128) -> __m128;
1925-
#[link_name = "llvm.x86.sse.sub.ss"]
1926-
fn subss(a: __m128, b: __m128) -> __m128;
1927-
#[link_name = "llvm.x86.sse.mul.ss"]
1928-
fn mulss(a: __m128, b: __m128) -> __m128;
1929-
#[link_name = "llvm.x86.sse.div.ss"]
1930-
fn divss(a: __m128, b: __m128) -> __m128;
1931-
#[link_name = "llvm.x86.sse.sqrt.ss"]
1932-
fn sqrtss(a: __m128) -> __m128;
1933-
#[link_name = "llvm.x86.sse.sqrt.ps"]
1934-
fn sqrtps(a: __m128) -> __m128;
19351923
#[link_name = "llvm.x86.sse.rcp.ss"]
19361924
fn rcpss(a: __m128) -> __m128;
19371925
#[link_name = "llvm.x86.sse.rcp.ps"]

0 commit comments

Comments
 (0)