mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 14:30:36 +00:00
added vshuf()
This commit is contained in:
parent
369decd8c3
commit
778d51ac0f
4 changed files with 160 additions and 0 deletions
22
neon.hh
22
neon.hh
|
|
@ -938,3 +938,25 @@ inline SIMD<int32_t, 4> vclamp(SIMD<int32_t, 4> x, int32_t a, int32_t b)
|
|||
return tmp;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline SIMD<uint8_t, 16> vshuf(SIMD<uint8_t, 16> a, SIMD<uint8_t, 16> b)
|
||||
{
|
||||
SIMD<uint8_t, 16> tmp;
|
||||
uint8x8x2_t c { vget_low_u8(a.m), vget_high_u8(a.m) };
|
||||
uint8x8_t d = vtbl2_u8(c, vget_low_u8(b.m));
|
||||
uint8x8_t e = vtbl2_u8(c, vget_high_u8(b.m));
|
||||
tmp.m = vcombine_u8(d, e);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline SIMD<int8_t, 16> vshuf(SIMD<int8_t, 16> a, SIMD<uint8_t, 16> b)
|
||||
{
|
||||
SIMD<int8_t, 16> tmp;
|
||||
int8x8x2_t c { vget_low_s8(a.m), vget_high_s8(a.m) };
|
||||
int8x8_t d = vtbl2_s8(c, vget_low_s8((int8x16_t)b.m));
|
||||
int8x8_t e = vtbl2_s8(c, vget_high_s8((int8x16_t)b.m));
|
||||
tmp.m = vcombine_s8(d, e);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue