Simplify Sk4i's Min/Max

CQ_INCLUDE_TRYBOTS=skia.primary:Test-Debian9-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD
Bug: skia:
Change-Id: Id82a58f2f4d947894bb710cb3190c873b20b98eb
Reviewed-on: https://skia-review.googlesource.com/23404
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
This commit is contained in:
Yuqian Li 2017-07-14 10:17:04 -04:00 committed by Skia Commit-Bot
parent 8abb9f4537
commit e94865e934

View File

@ -211,10 +211,7 @@ public:
#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE41
return _mm_min_epi32(x.fVec, y.fVec);
#else
__m128i less_than = _mm_cmplt_epi32(x.fVec, y.fVec);
__m128i choose_x = _mm_and_si128(less_than, x.fVec);
__m128i choose_y = _mm_andnot_si128(less_than, y.fVec);
return _mm_or_si128(choose_x, choose_y);
return (x < y).thenElse(x, y);
#endif
}
@ -222,10 +219,7 @@ public:
#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE41
return _mm_max_epi32(x.fVec, y.fVec);
#else
__m128i greater_than = _mm_cmpgt_epi32(x.fVec, y.fVec);
__m128i choose_x = _mm_and_si128(greater_than, x.fVec);
__m128i choose_y = _mm_andnot_si128(greater_than, y.fVec);
return _mm_or_si128(choose_x, choose_y);
return (x > y).thenElse(x, y);
#endif
}