diff options
author | Damjan Marion <damarion@cisco.com> | 2021-05-05 19:31:41 +0200 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2021-05-05 19:57:04 +0200 |
commit | 7d14aad6379ebf96b75dd076260a2fccb7caa3b4 (patch) | |
tree | d9d4618182aa3f0da578a583c459eb93f95a7c80 /src/vppinfra/vector_avx2.h | |
parent | a7cea39b335efbad736addf926a9fb2c8c64a460 (diff) |
vppinfra: fix x86 packs / packus wrappers
They both take signed value as input.
Type: fix
Change-Id: If3d8ec4e0b1c02d7d65262bdd9db49ff7fbfef39
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/vector_avx2.h')
-rw-r--r-- | src/vppinfra/vector_avx2.h | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/vppinfra/vector_avx2.h b/src/vppinfra/vector_avx2.h index 584bd207b27..f38a3bdae73 100644 --- a/src/vppinfra/vector_avx2.h +++ b/src/vppinfra/vector_avx2.h @@ -105,17 +105,19 @@ _(u64x2, u64x4) #undef _ /* *INDENT-ON* */ -always_inline u8x32 -u16x16_pack (u16x16 lo, u16x16 hi) -{ - return (u8x32) _mm256_packus_epi16 ((__m256i) lo, (__m256i) hi); -} +/* 256 bit packs. */ +#define _(f, t, fn) \ + always_inline t t##_pack (f lo, f hi) \ + { \ + return (t) fn ((__m256i) lo, (__m256i) hi); \ + } + +_ (i16x16, i8x32, _mm256_packs_epi16) +_ (i16x16, u8x32, _mm256_packus_epi16) +_ (i32x8, i16x16, _mm256_packs_epi32) +_ (i32x8, u16x16, _mm256_packus_epi32) -always_inline i8x32 -i16x16_pack (i16x16 lo, i16x16 hi) -{ - return (i8x32) _mm256_packs_epi16 ((__m256i) lo, (__m256i) hi); -} +#undef _ static_always_inline u32 u8x32_msb_mask (u8x32 v) |