mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 22:35:44 +00:00
added vcopysign()
This commit is contained in:
parent
778d51ac0f
commit
6cddcef660
4 changed files with 73 additions and 0 deletions
22
sse4_1.hh
22
sse4_1.hh
|
|
@ -598,6 +598,28 @@ inline SIMD<int32_t, 4> vsign(SIMD<int32_t, 4> a, SIMD<int32_t, 4> b)
|
|||
return tmp;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline SIMD<float, 4> vcopysign(SIMD<float, 4> a, SIMD<float, 4> b)
|
||||
{
|
||||
SIMD<float, 4> tmp;
|
||||
__m128 negz = _mm_set1_ps(-0.f);
|
||||
tmp.m = _mm_or_ps(
|
||||
_mm_andnot_ps(negz, a.m),
|
||||
_mm_and_ps(negz, b.m));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline SIMD<double, 2> vcopysign(SIMD<double, 2> a, SIMD<double, 2> b)
|
||||
{
|
||||
SIMD<double, 2> tmp;
|
||||
__m128 negz = _mm_set1_pd(-0.);
|
||||
tmp.m = _mm_or_pd(
|
||||
_mm_andnot_pd(negz, a.m),
|
||||
_mm_and_pd(negz, b.m));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline SIMD<uint8_t, 16> vorr(SIMD<uint8_t, 16> a, SIMD<uint8_t, 16> b)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue