Skip to content

Commit d84ccc3

Browse files
p32blognzlbg
authored andcommitted
Change _mm_mpsadbw_epu8 to work with unsigned integers
1 parent 193f66f commit d84ccc3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/x86/sse41.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ pub unsafe fn _mm_mullo_epi32(a: i32x4, b: i32x4) -> i32x4 {
848848
#[inline(always)]
849849
#[target_feature = "+sse4.1"]
850850
#[cfg_attr(test, assert_instr(mpsadbw, imm8=0))]
851-
pub unsafe fn _mm_mpsadbw_epu8(a: i8x16, b: i8x16, imm8: u8) -> i16x8 {
851+
pub unsafe fn _mm_mpsadbw_epu8(a: u8x16, b: u8x16, imm8: u8) -> u16x8 {
852852
macro_rules! call {
853853
($imm8:expr) => { mpsadbw(a, b, $imm8) }
854854
}
@@ -914,7 +914,7 @@ extern "C" {
914914
#[link_name = "llvm.x86.sse41.pmuldq"]
915915
fn pmuldq(a: i32x4, b: i32x4) -> i64x2;
916916
#[link_name = "llvm.x86.sse41.mpsadbw"]
917-
fn mpsadbw(a: i8x16, b: i8x16, imm8: u8) -> i16x8;
917+
fn mpsadbw(a: u8x16, b: u8x16, imm8: u8) -> u16x8;
918918
}
919919

920920
#[cfg(test)]
@@ -1624,26 +1624,26 @@ mod tests {
16241624

16251625
#[simd_test = "sse4.1"]
16261626
unsafe fn _mm_mpsadbw_epu8() {
1627-
let a = i8x16::new(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
1627+
let a = u8x16::new(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
16281628

16291629
let r = sse41::_mm_mpsadbw_epu8(a, a, 0b000);
1630-
let e = i16x8::new(0, 4, 8, 12, 16, 20, 24, 28);
1630+
let e = u16x8::new(0, 4, 8, 12, 16, 20, 24, 28);
16311631
assert_eq!(r, e);
16321632

16331633
let r = sse41::_mm_mpsadbw_epu8(a, a, 0b001);
1634-
let e = i16x8::new(16, 12, 8, 4, 0, 4, 8, 12);
1634+
let e = u16x8::new(16, 12, 8, 4, 0, 4, 8, 12);
16351635
assert_eq!(r, e);
16361636

16371637
let r = sse41::_mm_mpsadbw_epu8(a, a, 0b100);
1638-
let e = i16x8::new(16, 20, 24, 28, 32, 36, 40, 44);
1638+
let e = u16x8::new(16, 20, 24, 28, 32, 36, 40, 44);
16391639
assert_eq!(r, e);
16401640

16411641
let r = sse41::_mm_mpsadbw_epu8(a, a, 0b101);
1642-
let e = i16x8::new(0, 4, 8, 12, 16, 20, 24, 28);
1642+
let e = u16x8::new(0, 4, 8, 12, 16, 20, 24, 28);
16431643
assert_eq!(r, e);
16441644

16451645
let r = sse41::_mm_mpsadbw_epu8(a, a, 0b111);
1646-
let e = i16x8::new(32, 28, 24, 20, 16, 12, 8, 4);
1646+
let e = u16x8::new(32, 28, 24, 20, 16, 12, 8, 4);
16471647
assert_eq!(r, e);
16481648
}
16491649
}

0 commit comments

Comments
 (0)