Function core::arch::x86_64::_mm_extract_ps

1.27.0 · source ·
pub unsafe fn _mm_extract_ps(a: __m128, const IMM8: i32) -> i32
Available on (x86 or x86-64) and target feature sse4.1 and x86-64 only.
Expand description

Extracts a single-precision (32-bit) floating-point element from a, selected with IMM8. The returned i32 stores the float’s bit-pattern, and may be converted back to a floating point number via casting.

Example

let mut float_store = vec![1.0, 1.0, 2.0, 3.0];
let simd_floats = _mm_set_ps(2.5, 5.0, 7.5, 10.0);
let x: i32 = _mm_extract_ps::<2>(simd_floats);
float_store.push(f32::from_bits(x as u32));
assert_eq!(float_store, vec![1.0, 1.0, 2.0, 3.0, 5.0]);
Run

Intel’s documentation