remove unsafe from _mm_pause uses

This commit is contained in:
Folkert de Vries 2025-11-02 15:40:56 +01:00
parent b8261048ac
commit fd76e6dd54
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 7 additions and 15 deletions

View file

@ -271,11 +271,11 @@ pub fn spin_loop() {
crate::cfg_select! {
target_arch = "x86" => {
// SAFETY: the `cfg` attr ensures that we only execute this on x86 targets.
unsafe { crate::arch::x86::_mm_pause() }
crate::arch::x86::_mm_pause()
}
target_arch = "x86_64" => {
// SAFETY: the `cfg` attr ensures that we only execute this on x86_64 targets.
unsafe { crate::arch::x86_64::_mm_pause() }
crate::arch::x86_64::_mm_pause()
}
target_arch = "riscv32" => crate::arch::riscv32::pause(),
target_arch = "riscv64" => crate::arch::riscv64::pause(),

View file

@ -54,7 +54,7 @@ unsafe fn test_sse2() {
}
fn test_mm_pause() {
unsafe { _mm_pause() }
_mm_pause()
}
test_mm_pause();

View file

@ -7,17 +7,13 @@ mod x86 {
fn adc(c_in: u8, a: u32, b: u32) -> (u8, u32) {
let mut sum = 0;
// SAFETY: There are no safety requirements for calling `_addcarry_u32`.
// It's just unsafe for API consistency with other intrinsics.
let c_out = unsafe { arch::_addcarry_u32(c_in, a, b, &mut sum) };
let c_out = arch::_addcarry_u32(c_in, a, b, &mut sum);
(c_out, sum)
}
fn sbb(b_in: u8, a: u32, b: u32) -> (u8, u32) {
let mut sum = 0;
// SAFETY: There are no safety requirements for calling `_subborrow_u32`.
// It's just unsafe for API consistency with other intrinsics.
let b_out = unsafe { arch::_subborrow_u32(b_in, a, b, &mut sum) };
let b_out = arch::_subborrow_u32(b_in, a, b, &mut sum);
(b_out, sum)
}
@ -52,17 +48,13 @@ mod x86_64 {
fn adc(c_in: u8, a: u64, b: u64) -> (u8, u64) {
let mut sum = 0;
// SAFETY: There are no safety requirements for calling `_addcarry_u64`.
// It's just unsafe for API consistency with other intrinsics.
let c_out = unsafe { arch::_addcarry_u64(c_in, a, b, &mut sum) };
let c_out = arch::_addcarry_u64(c_in, a, b, &mut sum);
(c_out, sum)
}
fn sbb(b_in: u8, a: u64, b: u64) -> (u8, u64) {
let mut sum = 0;
// SAFETY: There are no safety requirements for calling `_subborrow_u64`.
// It's just unsafe for API consistency with other intrinsics.
let b_out = unsafe { arch::_subborrow_u64(b_in, a, b, &mut sum) };
let b_out = arch::_subborrow_u64(b_in, a, b, &mut sum);
(b_out, sum)
}