Add more selectors to the Lanes enum

This commit is contained in:
Henry de Valence 2018-06-14 14:19:46 -07:00
parent 64cb999866
commit 30a2b01c05

View file

@ -34,6 +34,8 @@ pub enum Lanes {
D, D,
AB, AB,
CD, CD,
AD,
BC,
ALL, ALL,
} }
@ -49,6 +51,10 @@ fn blend_lanes(x: u32x8, y: u32x8, control: Lanes) -> u32x8 {
Lanes::D => { Lanes::D => {
_mm256_blend_epi32(x.into_bits(), y.into_bits(), D_LANES as i32).into_bits() _mm256_blend_epi32(x.into_bits(), y.into_bits(), D_LANES as i32).into_bits()
} }
Lanes::AD => {
_mm256_blend_epi32(x.into_bits(), y.into_bits(), (A_LANES | D_LANES) as i32)
.into_bits()
}
Lanes::AB => { Lanes::AB => {
_mm256_blend_epi32(x.into_bits(), y.into_bits(), (A_LANES | B_LANES) as i32) _mm256_blend_epi32(x.into_bits(), y.into_bits(), (A_LANES | B_LANES) as i32)
.into_bits() .into_bits()
@ -57,9 +63,15 @@ fn blend_lanes(x: u32x8, y: u32x8, control: Lanes) -> u32x8 {
_mm256_blend_epi32(x.into_bits(), y.into_bits(), (C_LANES | D_LANES) as i32) _mm256_blend_epi32(x.into_bits(), y.into_bits(), (C_LANES | D_LANES) as i32)
.into_bits() .into_bits()
} }
Lanes::ALL => { Lanes::BC => {
_mm256_blend_epi32(x.into_bits(), y.into_bits(), ALL_LANES as i32).into_bits() _mm256_blend_epi32(x.into_bits(), y.into_bits(), (B_LANES | C_LANES) as i32)
.into_bits()
} }
Lanes::ALL => _mm256_blend_epi32(
x.into_bits(),
y.into_bits(),
(A_LANES | B_LANES | C_LANES | D_LANES) as i32,
).into_bits(),
} }
} }
} }