Skip to content

Commit fd76e6d

Browse files
committed
remove unsafe from _mm_pause uses
1 parent b826104 commit fd76e6d

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

library/core/src/hint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,11 @@ pub fn spin_loop() {
271271
crate::cfg_select! {
272272
target_arch = "x86" => {
273273
// SAFETY: the `cfg` attr ensures that we only execute this on x86 targets.
274-
unsafe { crate::arch::x86::_mm_pause() }
274+
crate::arch::x86::_mm_pause()
275275
}
276276
target_arch = "x86_64" => {
277277
// SAFETY: the `cfg` attr ensures that we only execute this on x86_64 targets.
278-
unsafe { crate::arch::x86_64::_mm_pause() }
278+
crate::arch::x86_64::_mm_pause()
279279
}
280280
target_arch = "riscv32" => crate::arch::riscv32::pause(),
281281
target_arch = "riscv64" => crate::arch::riscv64::pause(),

src/tools/miri/tests/pass/shims/x86/intrinsics-x86-sse2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ unsafe fn test_sse2() {
5454
}
5555

5656
fn test_mm_pause() {
57-
unsafe { _mm_pause() }
57+
_mm_pause()
5858
}
5959
test_mm_pause();
6060

src/tools/miri/tests/pass/shims/x86/intrinsics-x86.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,13 @@ mod x86 {
77

88
fn adc(c_in: u8, a: u32, b: u32) -> (u8, u32) {
99
let mut sum = 0;
10-
// SAFETY: There are no safety requirements for calling `_addcarry_u32`.
11-
// It's just unsafe for API consistency with other intrinsics.
12-
let c_out = unsafe { arch::_addcarry_u32(c_in, a, b, &mut sum) };
10+
let c_out = arch::_addcarry_u32(c_in, a, b, &mut sum);
1311
(c_out, sum)
1412
}
1513

1614
fn sbb(b_in: u8, a: u32, b: u32) -> (u8, u32) {
1715
let mut sum = 0;
18-
// SAFETY: There are no safety requirements for calling `_subborrow_u32`.
19-
// It's just unsafe for API consistency with other intrinsics.
20-
let b_out = unsafe { arch::_subborrow_u32(b_in, a, b, &mut sum) };
16+
let b_out = arch::_subborrow_u32(b_in, a, b, &mut sum);
2117
(b_out, sum)
2218
}
2319

@@ -52,17 +48,13 @@ mod x86_64 {
5248

5349
fn adc(c_in: u8, a: u64, b: u64) -> (u8, u64) {
5450
let mut sum = 0;
55-
// SAFETY: There are no safety requirements for calling `_addcarry_u64`.
56-
// It's just unsafe for API consistency with other intrinsics.
57-
let c_out = unsafe { arch::_addcarry_u64(c_in, a, b, &mut sum) };
51+
let c_out = arch::_addcarry_u64(c_in, a, b, &mut sum);
5852
(c_out, sum)
5953
}
6054

6155
fn sbb(b_in: u8, a: u64, b: u64) -> (u8, u64) {
6256
let mut sum = 0;
63-
// SAFETY: There are no safety requirements for calling `_subborrow_u64`.
64-
// It's just unsafe for API consistency with other intrinsics.
65-
let b_out = unsafe { arch::_subborrow_u64(b_in, a, b, &mut sum) };
57+
let b_out = arch::_subborrow_u64(b_in, a, b, &mut sum);
6658
(b_out, sum)
6759
}
6860

0 commit comments

Comments
 (0)