unsafe fn max_epu64(left: __m256i, right: __m256i) -> __m256iExamples found in repository?
crates/competitive/src/data_structure/simd.rs (line 275)
271pub unsafe fn max_index_u128x4_avx2(low: &[u64; 4], high: &[u64; 4]) -> usize {
272 let low = _mm256_loadu_si256(low.as_ptr().cast());
273 let high = _mm256_loadu_si256(high.as_ptr().cast());
274 let mut maximum_high = high;
275 maximum_high = max_epu64(maximum_high, _mm256_permute4x64_epi64::<0x4e>(maximum_high));
276 maximum_high = max_epu64(maximum_high, _mm256_permute4x64_epi64::<0xb1>(maximum_high));
277 let high_equal = _mm256_cmpeq_epi64(high, maximum_high);
278 let high_mask = _mm256_movemask_pd(_mm256_castsi256_pd(high_equal)) as u32 & 15;
279 if high_mask.is_power_of_two() {
280 return high_mask.trailing_zeros() as usize;
281 }
282 let mut maximum_low = _mm256_and_si256(low, high_equal);
283 maximum_low = max_epu64(maximum_low, _mm256_permute4x64_epi64::<0x4e>(maximum_low));
284 maximum_low = max_epu64(maximum_low, _mm256_permute4x64_epi64::<0xb1>(maximum_low));
285 let both = _mm256_and_si256(high_equal, _mm256_cmpeq_epi64(low, maximum_low));
286 (_mm256_movemask_pd(_mm256_castsi256_pd(both)) as u32 & 15).trailing_zeros() as usize
287}