Skip to content

Commit f724604

Browse files
committed
Make sse4.2 functions const
1 parent 901494d commit f724604

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

crates/core_arch/src/x86/sse42.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,8 @@ pub fn _mm_crc32_u32(crc: u32, v: u32) -> u32 {
563563
#[target_feature(enable = "sse4.2")]
564564
#[cfg_attr(test, assert_instr(pcmpgtq))]
565565
#[stable(feature = "simd_x86", since = "1.27.0")]
566-
pub fn _mm_cmpgt_epi64(a: __m128i, b: __m128i) -> __m128i {
566+
#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")]
567+
pub const fn _mm_cmpgt_epi64(a: __m128i, b: __m128i) -> __m128i {
567568
unsafe { transmute(simd_gt::<_, i64x2>(a.as_i64x2(), b.as_i64x2())) }
568569
}
569570

@@ -609,6 +610,7 @@ unsafe extern "C" {
609610

610611
#[cfg(test)]
611612
mod tests {
613+
use crate::core_arch::assert_eq_const as assert_eq;
612614
use stdarch_test::simd_test;
613615

614616
use crate::core_arch::x86::*;
@@ -789,7 +791,7 @@ mod tests {
789791
}
790792

791793
#[simd_test(enable = "sse4.2")]
792-
unsafe fn test_mm_cmpgt_epi64() {
794+
const unsafe fn test_mm_cmpgt_epi64() {
793795
let a = _mm_setr_epi64x(0, 0x2a);
794796
let b = _mm_set1_epi64x(0x00);
795797
let i = _mm_cmpgt_epi64(a, b);

0 commit comments

Comments
 (0)