@@ -33,23 +33,23 @@ use stdsimd_test::assert_instr;
33
33
#[ inline( always) ]
34
34
#[ target_feature = "+avx2" ]
35
35
#[ cfg_attr( test, assert_instr( vpabsd) ) ]
36
- pub unsafe fn _mm256_abs_epi32 ( a : i32x8 ) -> i32x8 {
36
+ pub unsafe fn _mm256_abs_epi32 ( a : i32x8 ) -> u32x8 {
37
37
pabsd ( a)
38
38
}
39
39
40
40
/// Computes the absolute values of packed 16-bit integers in `a`.
41
41
#[ inline( always) ]
42
42
#[ target_feature = "+avx2" ]
43
43
#[ cfg_attr( test, assert_instr( vpabsw) ) ]
44
- pub unsafe fn _mm256_abs_epi16 ( a : i16x16 ) -> i16x16 {
44
+ pub unsafe fn _mm256_abs_epi16 ( a : i16x16 ) -> u16x16 {
45
45
pabsw ( a)
46
46
}
47
47
48
48
/// Computes the absolute values of packed 8-bit integers in `a`.
49
49
#[ inline( always) ]
50
50
#[ target_feature = "+avx2" ]
51
51
#[ cfg_attr( test, assert_instr( vpabsb) ) ]
52
- pub unsafe fn _mm256_abs_epi8 ( a : i8x32 ) -> i8x32 {
52
+ pub unsafe fn _mm256_abs_epi8 ( a : i8x32 ) -> u8x32 {
53
53
pabsb ( a)
54
54
}
55
55
@@ -2000,11 +2000,11 @@ pub unsafe fn _mm256_xor_si256(a: __m256i, b: __m256i) -> __m256i {
2000
2000
#[ allow( improper_ctypes) ]
2001
2001
extern "C" {
2002
2002
#[ link_name = "llvm.x86.avx2.pabs.b" ]
2003
- fn pabsb ( a : i8x32 ) -> i8x32 ;
2003
+ fn pabsb ( a : i8x32 ) -> u8x32 ;
2004
2004
#[ link_name = "llvm.x86.avx2.pabs.w" ]
2005
- fn pabsw ( a : i16x16 ) -> i16x16 ;
2005
+ fn pabsw ( a : i16x16 ) -> u16x16 ;
2006
2006
#[ link_name = "llvm.x86.avx2.pabs.d" ]
2007
- fn pabsd ( a : i32x8 ) -> i32x8 ;
2007
+ fn pabsd ( a : i32x8 ) -> u32x8 ;
2008
2008
#[ link_name = "llvm.x86.avx2.padds.b" ]
2009
2009
fn paddsb ( a : i8x32 , b : i8x32 ) -> i8x32 ;
2010
2010
#[ link_name = "llvm.x86.avx2.padds.w" ]
@@ -2186,13 +2186,13 @@ mod tests {
2186
2186
#[ cfg_attr( rustfmt, rustfmt_skip) ]
2187
2187
let a = i32x8:: new (
2188
2188
0 , 1 , -1 , std:: i32:: MAX ,
2189
- std:: i32:: MIN + 1 , 100 , -100 , -32 ,
2189
+ std:: i32:: MIN , 100 , -100 , -32 ,
2190
2190
) ;
2191
2191
let r = avx2:: _mm256_abs_epi32 ( a) ;
2192
2192
#[ cfg_attr( rustfmt, rustfmt_skip) ]
2193
- let e = i32x8 :: new (
2194
- 0 , 1 , 1 , std:: i32:: MAX ,
2195
- ( std:: i32:: MIN + 1 ) . abs ( ) , 100 , 100 , 32 ,
2193
+ let e = u32x8 :: new (
2194
+ 0 , 1 , 1 , std:: i32:: MAX as u32 ,
2195
+ std:: i32:: MAX as u32 + 1 , 100 , 100 , 32 ,
2196
2196
) ;
2197
2197
assert_eq ! ( r, e) ;
2198
2198
}
@@ -2202,13 +2202,13 @@ mod tests {
2202
2202
#[ cfg_attr( rustfmt, rustfmt_skip) ]
2203
2203
let a = i16x16:: new (
2204
2204
0 , 1 , -1 , 2 , -2 , 3 , -3 , 4 ,
2205
- -4 , 5 , -5 , std:: i16:: MAX , std:: i16:: MIN + 1 , 100 , -100 , -32 ,
2205
+ -4 , 5 , -5 , std:: i16:: MAX , std:: i16:: MIN , 100 , -100 , -32 ,
2206
2206
) ;
2207
2207
let r = avx2:: _mm256_abs_epi16 ( a) ;
2208
2208
#[ cfg_attr( rustfmt, rustfmt_skip) ]
2209
- let e = i16x16 :: new (
2209
+ let e = u16x16 :: new (
2210
2210
0 , 1 , 1 , 2 , 2 , 3 , 3 , 4 ,
2211
- 4 , 5 , 5 , std:: i16:: MAX , ( std:: i16:: MIN + 1 ) . abs ( ) , 100 , 100 , 32 ,
2211
+ 4 , 5 , 5 , std:: i16:: MAX as u16 , std:: i16:: MAX as u16 + 1 , 100 , 100 , 32 ,
2212
2212
) ;
2213
2213
assert_eq ! ( r, e) ;
2214
2214
}
@@ -2218,17 +2218,17 @@ mod tests {
2218
2218
#[ cfg_attr( rustfmt, rustfmt_skip) ]
2219
2219
let a = i8x32:: new (
2220
2220
0 , 1 , -1 , 2 , -2 , 3 , -3 , 4 ,
2221
- -4 , 5 , -5 , std:: i8:: MAX , std:: i8:: MIN + 1 , 100 , -100 , -32 ,
2221
+ -4 , 5 , -5 , std:: i8:: MAX , std:: i8:: MIN , 100 , -100 , -32 ,
2222
2222
0 , 1 , -1 , 2 , -2 , 3 , -3 , 4 ,
2223
- -4 , 5 , -5 , std:: i8:: MAX , std:: i8:: MIN + 1 , 100 , -100 , -32 ,
2223
+ -4 , 5 , -5 , std:: i8:: MAX , std:: i8:: MIN , 100 , -100 , -32 ,
2224
2224
) ;
2225
2225
let r = avx2:: _mm256_abs_epi8 ( a) ;
2226
2226
#[ cfg_attr( rustfmt, rustfmt_skip) ]
2227
- let e = i8x32 :: new (
2227
+ let e = u8x32 :: new (
2228
2228
0 , 1 , 1 , 2 , 2 , 3 , 3 , 4 ,
2229
- 4 , 5 , 5 , std:: i8:: MAX , ( std:: i8:: MIN + 1 ) . abs ( ) , 100 , 100 , 32 ,
2229
+ 4 , 5 , 5 , std:: i8:: MAX as u8 , std:: i8:: MAX as u8 + 1 , 100 , 100 , 32 ,
2230
2230
0 , 1 , 1 , 2 , 2 , 3 , 3 , 4 ,
2231
- 4 , 5 , 5 , std:: i8:: MAX , ( std:: i8:: MIN + 1 ) . abs ( ) , 100 , 100 , 32 ,
2231
+ 4 , 5 , 5 , std:: i8:: MAX as u8 , std:: i8:: MAX as u8 + 1 , 100 , 100 , 32 ,
2232
2232
) ;
2233
2233
assert_eq ! ( r, e) ;
2234
2234
}
0 commit comments