mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 14:30:36 +00:00
added vmul() and vsignum()
This commit is contained in:
parent
0797171e03
commit
48303e7f58
4 changed files with 263 additions and 0 deletions
35
neon.hh
35
neon.hh
|
|
@ -444,6 +444,22 @@ inline SIMD<uint16_t, 8> vqsub(SIMD<uint16_t, 8> a, SIMD<uint16_t, 8> b)
|
|||
return tmp;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline SIMD<float, 4> vmul(SIMD<float, 4> a, SIMD<float, 4> b)
|
||||
{
|
||||
SIMD<float, 4> tmp;
|
||||
tmp.m = vmulq_f32(a.m, b.m);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline SIMD<int8_t, 16> vmul(SIMD<int8_t, 16> a, SIMD<int8_t, 16> b)
|
||||
{
|
||||
SIMD<int8_t, 16> tmp;
|
||||
tmp.m = vmulq_s8(a.m, b.m);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline SIMD<float, 4> vabs(SIMD<float, 4> a)
|
||||
{
|
||||
|
|
@ -468,6 +484,25 @@ inline SIMD<int16_t, 8> vqabs(SIMD<int16_t, 8> a)
|
|||
return tmp;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline SIMD<float, 4> vsignum(SIMD<float, 4> a)
|
||||
{
|
||||
SIMD<float, 4> tmp;
|
||||
tmp.m = (float32x4_t)vbicq_u32(
|
||||
veorq_u32((uint32x4_t)vdupq_n_f32(1.f), vandq_u32((uint32x4_t)vdupq_n_f32(-0.f), (uint32x4_t)a.m)),
|
||||
vceqq_f32(a.m, vdupq_n_f32(0.f)));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline SIMD<int8_t, 16> vsignum(SIMD<int8_t, 16> a)
|
||||
{
|
||||
SIMD<int8_t, 16> tmp;
|
||||
tmp.m = (int8x16_t)vorrq_u8(vcgtq_s8(vdupq_n_s8(0), a.m),
|
||||
vandq_u8(vcgtq_s8(a.m, vdupq_n_s8(0)), (uint8x16_t)vdupq_n_s8(1)));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline SIMD<float, 4> vsign(SIMD<float, 4> a, SIMD<float, 4> b)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue