Fix _mm_movemask_epi8
The order of iteration was wrong
This commit is contained in:
parent
aae9a8b91d
commit
ee4927e069
2 changed files with 4 additions and 1 deletions
|
@ -67,6 +67,9 @@ unsafe fn test_simd() {
|
||||||
test_mm_slli_si128();
|
test_mm_slli_si128();
|
||||||
test_mm_movemask_epi8();
|
test_mm_movemask_epi8();
|
||||||
test_mm256_movemask_epi8();
|
test_mm256_movemask_epi8();
|
||||||
|
|
||||||
|
let mask1 = _mm_movemask_epi8(dbg!(_mm_setr_epi8(255u8 as i8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)));
|
||||||
|
assert_eq!(mask1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[target_feature(enable = "sse2")]
|
#[target_feature(enable = "sse2")]
|
||||||
|
|
|
@ -41,7 +41,7 @@ pub fn codegen_llvm_intrinsic_call<'a, 'tcx: 'a>(
|
||||||
|
|
||||||
let mut res = fx.bcx.ins().iconst(types::I32, 0);
|
let mut res = fx.bcx.ins().iconst(types::I32, 0);
|
||||||
|
|
||||||
for lane in 0..lane_count {
|
for lane in (0..lane_count).rev() {
|
||||||
let a_lane = a.value_field(fx, mir::Field::new(lane.try_into().unwrap())).load_scalar(fx);
|
let a_lane = a.value_field(fx, mir::Field::new(lane.try_into().unwrap())).load_scalar(fx);
|
||||||
let a_lane_sign = fx.bcx.ins().ushr_imm(a_lane, 7); // extract sign bit of 8bit int
|
let a_lane_sign = fx.bcx.ins().ushr_imm(a_lane, 7); // extract sign bit of 8bit int
|
||||||
let a_lane_sign = fx.bcx.ins().uextend(types::I32, a_lane_sign);
|
let a_lane_sign = fx.bcx.ins().uextend(types::I32, a_lane_sign);
|
||||||
|
|
Loading…
Reference in a new issue