Skip to content

Commit 2f053bf

Browse files
committed
Make sse3 functions const
1 parent e87c77c commit 2f053bf

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

crates/core_arch/src/x86/sse3.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ use stdarch_test::assert_instr;
1414
#[target_feature(enable = "sse3")]
1515
#[cfg_attr(test, assert_instr(addsubps))]
1616
#[stable(feature = "simd_x86", since = "1.27.0")]
17-
pub fn _mm_addsub_ps(a: __m128, b: __m128) -> __m128 {
17+
#[rustc_const_unstable(feature = "stdarch_const_intrinsics", issue = "none")]
18+
pub const fn _mm_addsub_ps(a: __m128, b: __m128) -> __m128 {
1819
unsafe {
1920
let a = a.as_f32x4();
2021
let b = b.as_f32x4();
@@ -32,7 +33,8 @@ pub fn _mm_addsub_ps(a: __m128, b: __m128) -> __m128 {
3233
#[target_feature(enable = "sse3")]
3334
#[cfg_attr(test, assert_instr(addsubpd))]
3435
#[stable(feature = "simd_x86", since = "1.27.0")]
35-
pub fn _mm_addsub_pd(a: __m128d, b: __m128d) -> __m128d {
36+
#[rustc_const_unstable(feature = "stdarch_const_intrinsics", issue = "none")]
37+
pub const fn _mm_addsub_pd(a: __m128d, b: __m128d) -> __m128d {
3638
unsafe {
3739
let a = a.as_f64x2();
3840
let b = b.as_f64x2();
@@ -111,7 +113,8 @@ pub unsafe fn _mm_lddqu_si128(mem_addr: *const __m128i) -> __m128i {
111113
#[target_feature(enable = "sse3")]
112114
#[cfg_attr(test, assert_instr(movddup))]
113115
#[stable(feature = "simd_x86", since = "1.27.0")]
114-
pub fn _mm_movedup_pd(a: __m128d) -> __m128d {
116+
#[rustc_const_unstable(feature = "stdarch_const_intrinsics", issue = "none")]
117+
pub const fn _mm_movedup_pd(a: __m128d) -> __m128d {
115118
unsafe { simd_shuffle!(a, a, [0, 0]) }
116119
}
117120

@@ -123,7 +126,8 @@ pub fn _mm_movedup_pd(a: __m128d) -> __m128d {
123126
#[target_feature(enable = "sse3")]
124127
#[cfg_attr(test, assert_instr(movddup))]
125128
#[stable(feature = "simd_x86", since = "1.27.0")]
126-
pub unsafe fn _mm_loaddup_pd(mem_addr: *const f64) -> __m128d {
129+
#[rustc_const_unstable(feature = "stdarch_const_intrinsics", issue = "none")]
130+
pub const unsafe fn _mm_loaddup_pd(mem_addr: *const f64) -> __m128d {
127131
_mm_load1_pd(mem_addr)
128132
}
129133

@@ -135,7 +139,8 @@ pub unsafe fn _mm_loaddup_pd(mem_addr: *const f64) -> __m128d {
135139
#[target_feature(enable = "sse3")]
136140
#[cfg_attr(test, assert_instr(movshdup))]
137141
#[stable(feature = "simd_x86", since = "1.27.0")]
138-
pub fn _mm_movehdup_ps(a: __m128) -> __m128 {
142+
#[rustc_const_unstable(feature = "stdarch_const_intrinsics", issue = "none")]
143+
pub const fn _mm_movehdup_ps(a: __m128) -> __m128 {
139144
unsafe { simd_shuffle!(a, a, [1, 1, 3, 3]) }
140145
}
141146

@@ -147,7 +152,8 @@ pub fn _mm_movehdup_ps(a: __m128) -> __m128 {
147152
#[target_feature(enable = "sse3")]
148153
#[cfg_attr(test, assert_instr(movsldup))]
149154
#[stable(feature = "simd_x86", since = "1.27.0")]
150-
pub fn _mm_moveldup_ps(a: __m128) -> __m128 {
155+
#[rustc_const_unstable(feature = "stdarch_const_intrinsics", issue = "none")]
156+
pub const fn _mm_moveldup_ps(a: __m128) -> __m128 {
151157
unsafe { simd_shuffle!(a, a, [0, 0, 2, 2]) }
152158
}
153159

0 commit comments

Comments
 (0)