4 #![feature(const_eval_select)]
5 #![feature(core_intrinsics)]
6 use std::intrinsics::const_eval_select;
7 use std::arch::x86_64::*;
8 use std::mem::transmute;
10 const fn eq_ct(x: [i32; 4], y: [i32; 4]) -> bool {
11 x[0] == y[0] && x[1] == y[1] && x[2] == y[2] && x[3] == y[3]
14 fn eq_rt(x: [i32; 4], y: [i32; 4]) -> bool {
16 let x = _mm_loadu_si128(&x as *const _ as *const _);
17 let y = _mm_loadu_si128(&y as *const _ as *const _);
18 let r = _mm_cmpeq_epi32(x, y);
19 let r = _mm_movemask_ps(transmute(r) );
24 const fn eq(x: [i32; 4], y: [i32; 4]) -> bool {
26 const_eval_select((x, y), eq_ct, eq_rt)
31 const X: bool = eq([0, 1, 2, 3], [0, 1, 2, 3]);
33 let x = eq([0, 1, 2, 3], [0, 1, 2, 3]);
36 const Y: bool = eq([0, 1, 2, 3], [0, 1, 3, 2]);
38 let y = eq([0, 1, 2, 3], [0, 1, 3, 2]);