aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-02-10 15:23:15 +0100
committerFlorin Coras <florin.coras@gmail.com>2022-02-10 15:45:00 +0000
commite01ce5ad5d93c2239d0885d4b9486ba10447a529 (patch)
tree12c62f7370dd5270eb0f10026645436138a43143
parentf8c8809d009ea6e3785e4b66047d2b4982d6286e (diff)
vppinfra:remove uXxY_is_greater
not needed, '>' works... Type: improvement Change-Id: I9bfbac787e8dca24e9b1bceda0922740eed26346 Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--src/plugins/crypto_native/aes.h4
-rw-r--r--src/vppinfra/string.h12
-rw-r--r--src/vppinfra/vector_avx2.h6
-rw-r--r--src/vppinfra/vector_neon.h6
-rw-r--r--src/vppinfra/vector_sse42.h6
5 files changed, 8 insertions, 26 deletions
diff --git a/src/plugins/crypto_native/aes.h b/src/plugins/crypto_native/aes.h
index 0ba4e87af52..e7f840975d4 100644
--- a/src/plugins/crypto_native/aes.h
+++ b/src/plugins/crypto_native/aes.h
@@ -108,7 +108,7 @@ aes_block_store (u8 * p, u8x16 r)
static_always_inline u8x16
aes_byte_mask (u8x16 x, u8 n_bytes)
{
- return x & u8x16_is_greater (u8x16_splat (n_bytes), byte_mask_scale);
+ return x & (u8x16_splat (n_bytes) > byte_mask_scale);
}
static_always_inline u8x16
@@ -132,7 +132,7 @@ aes_store_partial (void *p, u8x16 r, int n_bytes)
#ifdef __AVX512F__
_mm_mask_storeu_epi8 (p, (1 << n_bytes) - 1, (__m128i) r);
#else
- u8x16 mask = u8x16_is_greater (u8x16_splat (n_bytes), byte_mask_scale);
+ u8x16 mask = u8x16_splat (n_bytes) > byte_mask_scale;
_mm_maskmoveu_si128 ((__m128i) r, (__m128i) mask, p);
#endif
#endif
diff --git a/src/vppinfra/string.h b/src/vppinfra/string.h
index 758a541814d..8c5bea16393 100644
--- a/src/vppinfra/string.h
+++ b/src/vppinfra/string.h
@@ -232,14 +232,14 @@ clib_memcpy_le (u8 * dst, u8 * src, u8 len, u8 max_len)
d0 = u8x32_load_unaligned (dst);
d1 = u8x32_load_unaligned (dst + 32);
- d0 = u8x32_blend (d0, s0, u8x32_is_greater (lv, mask));
+ d0 = u8x32_blend (d0, s0, lv > mask);
u8x32_store_unaligned (d0, dst);
if (max_len <= 32)
return;
mask += add;
- d1 = u8x32_blend (d1, s1, u8x32_is_greater (lv, mask));
+ d1 = u8x32_blend (d1, s1, lv > mask);
u8x32_store_unaligned (d1, dst + 32);
#elif defined (CLIB_HAVE_VEC128)
@@ -257,25 +257,25 @@ clib_memcpy_le (u8 * dst, u8 * src, u8 len, u8 max_len)
d2 = u8x16_load_unaligned (dst + 32);
d3 = u8x16_load_unaligned (dst + 48);
- d0 = u8x16_blend (d0, s0, u8x16_is_greater (lv, mask));
+ d0 = u8x16_blend (d0, s0, lv > mask);
u8x16_store_unaligned (d0, dst);
if (max_len <= 16)
return;
mask += add;
- d1 = u8x16_blend (d1, s1, u8x16_is_greater (lv, mask));
+ d1 = u8x16_blend (d1, s1, lv > mask);
u8x16_store_unaligned (d1, dst + 16);
if (max_len <= 32)
return;
mask += add;
- d2 = u8x16_blend (d2, s2, u8x16_is_greater (lv, mask));
+ d2 = u8x16_blend (d2, s2, lv > mask);
u8x16_store_unaligned (d2, dst + 32);
mask += add;
- d3 = u8x16_blend (d3, s3, u8x16_is_greater (lv, mask));
+ d3 = u8x16_blend (d3, s3, lv > mask);
u8x16_store_unaligned (d3, dst + 48);
#else
memmove (dst, src, len);
diff --git a/src/vppinfra/vector_avx2.h b/src/vppinfra/vector_avx2.h
index 6a363ccfa92..f5c09a53f96 100644
--- a/src/vppinfra/vector_avx2.h
+++ b/src/vppinfra/vector_avx2.h
@@ -316,12 +316,6 @@ u32x8_scatter_one (u32x8 r, int index, void *p)
}
static_always_inline u8x32
-u8x32_is_greater (u8x32 v1, u8x32 v2)
-{
- return (u8x32) _mm256_cmpgt_epi8 ((__m256i) v1, (__m256i) v2);
-}
-
-static_always_inline u8x32
u8x32_blend (u8x32 v1, u8x32 v2, u8x32 mask)
{
return (u8x32) _mm256_blendv_epi8 ((__m256i) v1, (__m256i) v2,
diff --git a/src/vppinfra/vector_neon.h b/src/vppinfra/vector_neon.h
index e7b31259f73..568b689c234 100644
--- a/src/vppinfra/vector_neon.h
+++ b/src/vppinfra/vector_neon.h
@@ -88,12 +88,6 @@ u8x16_compare_byte_mask (u8x16 v)
return u8x16_compare_byte_mask (v); \
} \
\
- static_always_inline u##s##x##c t##s##x##c##_is_greater (t##s##x##c a, \
- t##s##x##c b) \
- { \
- return (u##s##x##c) vcgtq_##i (a, b); \
- } \
- \
static_always_inline t##s##x##c t##s##x##c##_add_saturate (t##s##x##c a, \
t##s##x##c b) \
{ \
diff --git a/src/vppinfra/vector_sse42.h b/src/vppinfra/vector_sse42.h
index 35495d6658f..2b8927b6920 100644
--- a/src/vppinfra/vector_sse42.h
+++ b/src/vppinfra/vector_sse42.h
@@ -478,12 +478,6 @@ u32x4_scatter_one (u32x4 r, int index, void *p)
}
static_always_inline u8x16
-u8x16_is_greater (u8x16 v1, u8x16 v2)
-{
- return (u8x16) _mm_cmpgt_epi8 ((__m128i) v1, (__m128i) v2);
-}
-
-static_always_inline u8x16
u8x16_blend (u8x16 v1, u8x16 v2, u8x16 mask)
{
return (u8x16) _mm_blendv_epi8 ((__m128i) v1, (__m128i) v2, (__m128i) mask);