compiler_builtins/math/libm_math/arch/x86.rs
1//! Architecture-specific support for x86-32 and x86-64 with SSE2
2
3mod detect;
4mod fma;
5
6pub use fma::{fma, fmaf};
7
8pub fn sqrtf(mut x: f32) -> f32 {
9 // SAFETY: `sqrtss` is part of `sse2`, which this module is gated behind. It has no memory
10 // access or side effects.
11 unsafe {
12 core::arch::asm!(
13 "sqrtss {x}, {x}",
14 x = inout(xmm_reg) x,
15 options(nostack, nomem, pure),
16 )
17 };
18 x
19}
20
21pub fn sqrt(mut x: f64) -> f64 {
22 // SAFETY: `sqrtsd` is part of `sse2`, which this module is gated behind. It has no memory
23 // access or side effects.
24 unsafe {
25 core::arch::asm!(
26 "sqrtsd {x}, {x}",
27 x = inout(xmm_reg) x,
28 options(nostack, nomem, pure),
29 )
30 };
31 x
32}