mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
remove unsafe from _mm_pause uses
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -54,7 +54,7 @@ unsafe fn assert_eq_m128d(a: __m128d, b: __m128d) {
|
||||
}
|
||||
|
||||
fn test_mm_pause() {
|
||||
unsafe { _mm_pause() }
|
||||
_mm_pause()
|
||||
}
|
||||
test_mm_pause();
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user