Clean up ScopedFtz conditional compilation for MIRI
This commit is contained in:
parent
4c87db906a
commit
d20b9a19ee
1 changed files with 10 additions and 9 deletions
|
@ -203,19 +203,20 @@ struct ScopedFtz {
|
||||||
|
|
||||||
impl ScopedFtz {
|
impl ScopedFtz {
|
||||||
fn enable() -> Self {
|
fn enable() -> Self {
|
||||||
|
#[cfg(not(miri))]
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(all(target_feature = "sse", not(miri)))] {
|
if #[cfg(target_feature = "sse")] {
|
||||||
let mode = unsafe { std::arch::x86_64::_MM_GET_FLUSH_ZERO_MODE() };
|
let mode = unsafe { std::arch::x86_64::_MM_GET_FLUSH_ZERO_MODE() };
|
||||||
let should_disable_again = mode != std::arch::x86_64::_MM_FLUSH_ZERO_ON;
|
let should_disable_again = mode != std::arch::x86_64::_MM_FLUSH_ZERO_ON;
|
||||||
if should_disable_again {
|
if should_disable_again {
|
||||||
unsafe { std::arch::x86_64::_MM_SET_FLUSH_ZERO_MODE(std::arch::x86_64::_MM_FLUSH_ZERO_ON) };
|
unsafe { std::arch::x86_64::_MM_SET_FLUSH_ZERO_MODE(std::arch::x86_64::_MM_FLUSH_ZERO_ON) };
|
||||||
}
|
}
|
||||||
|
|
||||||
Self {
|
return Self {
|
||||||
should_disable_again,
|
should_disable_again,
|
||||||
_send_sync_marker: PhantomData,
|
_send_sync_marker: PhantomData,
|
||||||
}
|
}
|
||||||
} else if #[cfg(all(target_arch = "aarch64", not(miri)))] {
|
} else if #[cfg(target_arch = "aarch64")] {
|
||||||
// There are no convient intrinsics to change the FTZ settings on AArch64, so this
|
// There are no convient intrinsics to change the FTZ settings on AArch64, so this
|
||||||
// requires inline assembly:
|
// requires inline assembly:
|
||||||
// https://developer.arm.com/documentation/ddi0595/2021-06/AArch64-Registers/FPCR--Floating-point-Control-Register
|
// https://developer.arm.com/documentation/ddi0595/2021-06/AArch64-Registers/FPCR--Floating-point-Control-Register
|
||||||
|
@ -227,17 +228,17 @@ impl ScopedFtz {
|
||||||
unsafe { std::arch::asm!("msr fpcr, {}", in(reg) fpcr | AARCH64_FTZ_BIT) };
|
unsafe { std::arch::asm!("msr fpcr, {}", in(reg) fpcr | AARCH64_FTZ_BIT) };
|
||||||
}
|
}
|
||||||
|
|
||||||
Self {
|
return Self {
|
||||||
should_disable_again,
|
should_disable_again,
|
||||||
_send_sync_marker: PhantomData,
|
_send_sync_marker: PhantomData,
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Self {
|
|
||||||
should_disable_again: false,
|
|
||||||
_send_sync_marker: PhantomData,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Self {
|
||||||
|
should_disable_again: false,
|
||||||
|
_send_sync_marker: PhantomData,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue