Function safe_arch::shuffle_abi_f32_all_m128

source ·
pub fn shuffle_abi_f32_all_m128<const MASK: i32>(a: m128, b: m128) -> m128
Available with target feature sse only.
Expand description

Shuffle the f32 lanes from $a and $b together using an immediate control value.

The a: and b: prefixes on the index selection values are literal tokens that you type. It helps keep clear what value comes from where. The first two output lanes come from $a, the second two output lanes come from $b.

You can pass the same value as both arguments, but if you want to swizzle within only a single register and you have avx available consider using [shuffle_ai_f32_all_m128] instead. You’ll get much better performance.

let a = m128::from_array([1.0, 2.0, 3.0, 4.0]);
let b = m128::from_array([5.0, 6.0, 7.0, 8.0]);
//
let c = shuffle_abi_f32_all_m128::<0>(a, b).to_array();
assert_eq!(c, [1.0, 1.0, 5.0, 5.0]);
//
let c = shuffle_abi_f32_all_m128::<0b11_10_01_00>(a, b).to_array();
assert_eq!(c, [1.0, 2.0, 7.0, 8.0]);
//
let c = shuffle_abi_f32_all_m128::<0b00_10_10_01>(a, b).to_array();
assert_eq!(c, [2.0, 3.0, 7.0, 5.0]);