Commit a2fa9ee3 authored by Steinar Midtskogen's avatar Steinar Midtskogen
Browse files

Improve SSE2 implementation of v64_abs_s8 and v128_abs_s8

Change-Id: I5243432106c2456f1220adb9d8f24ae5e4249748
parent 6033fb85
......@@ -124,9 +124,8 @@ SIMD_INLINE v128 v128_abs_s8(v128 a) {
#if defined(__SSSE3__)
return _mm_abs_epi8(a);
#else
v128 t = _mm_sub_epi8(_mm_setzero_si128(), a);
v128 mask = _mm_cmplt_epi8(t, a);
return _mm_or_si128(_mm_andnot_si128(mask, t), _mm_and_si128(mask, a));
v128 sign = _mm_cmplt_epi8(a, _mm_setzero_si128());
return _mm_xor_si128(sign, _mm_add_epi8(a, sign));
#endif
}
......
......@@ -142,9 +142,8 @@ SIMD_INLINE v64 v64_abs_s8(v64 a) {
#if defined(__SSSE3__)
return _mm_abs_epi8(a);
#else
v64 t = _mm_sub_epi8(_mm_setzero_si128(), a);
v64 mask = _mm_cmplt_epi8(t, a);
return _mm_or_si128(_mm_andnot_si128(mask, t), _mm_and_si128(mask, a));
v64 sign = _mm_cmplt_epi8(a, _mm_setzero_si128());
return _mm_xor_si128(sign, _mm_add_epi8(a, sign));
#endif
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment