aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-12-23 13:59:20 +0100
committerDamjan Marion <damarion@cisco.com>2018-12-23 18:12:45 +0100
commitbde17bd6ef391766712ae7fbd766371037dfd3de (patch)
tree06c8156701ca8e73f182ab8e664cdbab22cf483b /src
parent7b8f9166883bd1a277770453bb9dabdc66e58805 (diff)
avf: optimize rx ring refill
Change-Id: Id35089d6c73b35cd25fd01e07966a2c7e2ea367e Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/avf/input.c129
1 files changed, 53 insertions, 76 deletions
diff --git a/src/plugins/avf/input.c b/src/plugins/avf/input.c
index a672a1593c0..d8202d54faf 100644
--- a/src/plugins/avf/input.c
+++ b/src/plugins/avf/input.c
@@ -46,104 +46,89 @@ static __clib_unused char *avf_input_error_strings[] = {
#define AVF_RX_DESC_STATUS_EOP AVF_RX_DESC_STATUS(1)
#define AVF_INPUT_REFILL_TRESHOLD 32
+
+static_always_inline void
+avf_rx_desc_write (avf_rx_desc_t * d, u64 addr)
+{
+#ifdef CLIB_HAVE_VEC256
+ u64x4 v = { addr, 0, 0, 0 };
+ u64x4_store_unaligned (v, (void *) d);
+#else
+ d->qword[0] = addr;
+ d->qword[1] = 0;
+#endif
+}
+
static_always_inline void
avf_rxq_refill (vlib_main_t * vm, vlib_node_runtime_t * node, avf_rxq_t * rxq,
int use_va_dma)
{
- u16 n_refill, mask, n_alloc, slot;
- u32 s0, s1, s2, s3;
- vlib_buffer_t *b[4];
- avf_rx_desc_t *d[4];
-
- n_refill = rxq->size - 1 - rxq->n_enqueued;
+ u16 n_refill, mask, n_alloc, slot, size;
+ vlib_buffer_t *b[8];
+ avf_rx_desc_t *d, *first_d;
+ void *p[8];
+
+ size = rxq->size;
+ mask = size - 1;
+ n_refill = mask - rxq->n_enqueued;
if (PREDICT_TRUE (n_refill <= AVF_INPUT_REFILL_TRESHOLD))
return;
- mask = rxq->size - 1;
slot = (rxq->next - n_refill - 1) & mask;
n_refill &= ~7; /* round to 8 */
- n_alloc = vlib_buffer_alloc_to_ring (vm, rxq->bufs, slot, rxq->size,
- n_refill);
+ n_alloc = vlib_buffer_alloc_to_ring (vm, rxq->bufs, slot, size, n_refill);
if (PREDICT_FALSE (n_alloc != n_refill))
{
vlib_error_count (vm, node->node_index,
AVF_INPUT_ERROR_BUFFER_ALLOC, 1);
if (n_alloc)
- vlib_buffer_free_from_ring (vm, rxq->bufs, slot, rxq->size, n_alloc);
+ vlib_buffer_free_from_ring (vm, rxq->bufs, slot, size, n_alloc);
return;
}
rxq->n_enqueued += n_alloc;
+ first_d = rxq->descs;
- while (n_alloc >= 4)
- {
- if (PREDICT_TRUE (slot + 3 < rxq->size))
- {
- s0 = slot;
- s1 = slot + 1;
- s2 = slot + 2;
- s3 = slot + 3;
- }
- else
- {
- s0 = slot;
- s1 = (slot + 1) & mask;
- s2 = (slot + 2) & mask;
- s3 = (slot + 3) & mask;
- }
+ ASSERT (slot % 8 == 0);
- d[0] = ((avf_rx_desc_t *) rxq->descs) + s0;
- d[1] = ((avf_rx_desc_t *) rxq->descs) + s1;
- d[2] = ((avf_rx_desc_t *) rxq->descs) + s2;
- d[3] = ((avf_rx_desc_t *) rxq->descs) + s3;
- b[0] = vlib_get_buffer (vm, rxq->bufs[s0]);
- b[1] = vlib_get_buffer (vm, rxq->bufs[s1]);
- b[2] = vlib_get_buffer (vm, rxq->bufs[s2]);
- b[3] = vlib_get_buffer (vm, rxq->bufs[s3]);
+ while (n_alloc >= 8)
+ {
+ d = first_d + slot;
if (use_va_dma)
{
- d[0]->qword[0] = vlib_buffer_get_va (b[0]);
- d[1]->qword[0] = vlib_buffer_get_va (b[1]);
- d[2]->qword[0] = vlib_buffer_get_va (b[2]);
- d[3]->qword[0] = vlib_buffer_get_va (b[3]);
+ vlib_get_buffers_with_offset (vm, rxq->bufs + slot, p, 8,
+ sizeof (vlib_buffer_t));
+ avf_rx_desc_write (d + 0, pointer_to_uword (p[0]));
+ avf_rx_desc_write (d + 1, pointer_to_uword (p[1]));
+ avf_rx_desc_write (d + 2, pointer_to_uword (p[2]));
+ avf_rx_desc_write (d + 3, pointer_to_uword (p[3]));
+ avf_rx_desc_write (d + 4, pointer_to_uword (p[4]));
+ avf_rx_desc_write (d + 5, pointer_to_uword (p[5]));
+ avf_rx_desc_write (d + 6, pointer_to_uword (p[6]));
+ avf_rx_desc_write (d + 7, pointer_to_uword (p[7]));
}
else
{
- d[0]->qword[0] = vlib_buffer_get_pa (vm, b[0]);
- d[1]->qword[0] = vlib_buffer_get_pa (vm, b[1]);
- d[2]->qword[0] = vlib_buffer_get_pa (vm, b[2]);
- d[3]->qword[0] = vlib_buffer_get_pa (vm, b[3]);
+ vlib_get_buffers (vm, rxq->bufs + slot, b, 8);
+ avf_rx_desc_write (d + 0, vlib_buffer_get_pa (vm, b[0]));
+ avf_rx_desc_write (d + 1, vlib_buffer_get_pa (vm, b[1]));
+ avf_rx_desc_write (d + 2, vlib_buffer_get_pa (vm, b[2]));
+ avf_rx_desc_write (d + 3, vlib_buffer_get_pa (vm, b[3]));
+ avf_rx_desc_write (d + 4, vlib_buffer_get_pa (vm, b[4]));
+ avf_rx_desc_write (d + 5, vlib_buffer_get_pa (vm, b[5]));
+ avf_rx_desc_write (d + 6, vlib_buffer_get_pa (vm, b[6]));
+ avf_rx_desc_write (d + 7, vlib_buffer_get_pa (vm, b[7]));
}
- d[0]->qword[1] = 0;
- d[1]->qword[1] = 0;
- d[2]->qword[1] = 0;
- d[3]->qword[1] = 0;
-
- /* next */
- slot = (slot + 4) & mask;
- n_alloc -= 4;
- }
- while (n_alloc)
- {
- s0 = slot;
- d[0] = ((avf_rx_desc_t *) rxq->descs) + s0;
- b[0] = vlib_get_buffer (vm, rxq->bufs[s0]);
- if (use_va_dma)
- d[0]->qword[0] = vlib_buffer_get_va (b[0]);
- else
- d[0]->qword[0] = vlib_buffer_get_pa (vm, b[0]);
- d[0]->qword[1] = 0;
-
/* next */
- slot = (slot + 1) & mask;
- n_alloc -= 1;
+ slot = (slot + 8) & mask;
+ n_alloc -= 8;
}
- CLIB_MEMORY_BARRIER ();
+ CLIB_MEMORY_STORE_BARRIER ();
*(rxq->qrx_tail) = slot;
}
@@ -223,7 +208,7 @@ avf_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
u16 mask = rxq->size - 1;
u16 n_rxv = 0;
u8 or_error = 0;
- u32 *bi;
+ u32 *bi, *to_next, n_left_to_next;
vlib_buffer_t *bufs[AVF_RX_VECTOR_SZ];
vlib_buffer_t *bt = &ptd->buffer_template;
u32 next_index = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT;
@@ -239,7 +224,6 @@ avf_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if ((d->qword[1] & AVF_RX_DESC_STATUS_DD) == 0)
goto done;
- u32 *to_next, n_left_to_next;
if (PREDICT_FALSE (ad->per_interface_next_index != ~0))
next_index = ad->per_interface_next_index;
vlib_get_new_next_frame (vm, node, next_index, to_next, n_left_to_next);
@@ -272,15 +256,8 @@ avf_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if (rxq->next >= rxq->size - 4)
goto one_by_one;
- /* load 1st quadword of 4 dscriptors into 256-bit vector register */
- /* *INDENT-OFF* */
- q1x4 = (u64x4) {
- d[0].qword[1],
- d[1].qword[1],
- d[2].qword[1],
- d[3].qword[1]
- };
- /* *INDENT-ON* */
+ q1x4 = u64x4_gather ((void *) &d[0].qword[1], (void *) &d[1].qword[1],
+ (void *) &d[2].qword[1], (void *) &d[3].qword[1]);
/* not all packets are ready or at least one of them is chained */
if (!u64x4_is_equal (q1x4 & status_dd_eop_mask, status_dd_eop_mask))
/ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * Copyright (c) 2015 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
  Copyright (c) 2008 Eliot Dresselhaus

  Permission is hereby granted, free of charge, to any person obtaining
  a copy of this software and associated documentation files (the
  "Software"), to deal in the Software without restriction, including
  without limitation the rights to use, copy, modify, merge, publish,
  distribute, sublicense, and/or sell copies of the Software, and to
  permit persons to whom the Software is furnished to do so, subject to
  the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#ifndef included_vector_funcs_h
#define included_vector_funcs_h

#include <vppinfra/byte_order.h>

/* Addition/subtraction. */
#if CLIB_VECTOR_WORD_BITS == 128
#define u8x_add u8x16_add
#define u16x_add u16x8_add
#define u32x_add u32x4_add
#define u64x_add u64x2_add
#define i8x_add i8x16_add
#define i16x_add i16x8_add
#define i32x_add i32x4_add
#define i64x_add i64x2_add
#define u8x_sub u8x16_sub
#define u16x_sub u16x8_sub
#define u32x_sub u32x4_sub
#define u64x_sub u64x2_sub
#define i8x_sub i8x16_sub
#define i16x_sub i16x8_sub
#define i32x_sub i32x4_sub
#define i64x_sub i64x2_sub
#endif

#if CLIB_VECTOR_WORD_BITS == 64
#define u8x_add u8x8_add
#define u16x_add u16x4_add
#define u32x_add u32x2_add
#define i8x_add i8x8_add
#define i16x_add i16x4_add
#define i32x_add i32x2_add
#define u8x_sub u8x8_sub
#define u16x_sub u16x4_sub
#define u32x_sub u32x2_sub
#define i8x_sub i8x8_sub
#define i16x_sub i16x4_sub
#define i32x_sub i32x2_sub
#endif

/* Saturating addition/subtraction. */
#if CLIB_VECTOR_WORD_BITS == 128
#define u8x_add_saturate u8x16_add_saturate
#define u16x_add_saturate u16x8_add_saturate
#define i8x_add_saturate i8x16_add_saturate
#define i16x_add_saturate i16x8_add_saturate
#define u8x_sub_saturate u8x16_sub_saturate
#define u16x_sub_saturate u16x8_sub_saturate
#define i8x_sub_saturate i8x16_sub_saturate
#define i16x_sub_saturate i16x8_sub_saturate
#endif

#if CLIB_VECTOR_WORD_BITS == 64
#define u8x_add_saturate u8x8_add_saturate
#define u16x_add_saturate u16x4_add_saturate
#define i8x_add_saturate i8x8_add_saturate
#define i16x_add_saturate i16x4_add_saturate
#define u8x_sub_saturate u8x8_sub_saturate
#define u16x_sub_saturate u16x4_sub_saturate
#define i8x_sub_saturate i8x8_sub_saturate
#define i16x_sub_saturate i16x4_sub_saturate
#endif

#define _vector_interleave(a,b,t)		\
do {						\
  t _tmp_lo = t##_interleave_lo (a, b);		\
  t _tmp_hi = t##_interleave_hi (a, b);		\
  if (CLIB_ARCH_IS_LITTLE_ENDIAN)		\
    (a) = _tmp_lo, (b) = _tmp_hi;		\
  else						\
    (a) = _tmp_hi, (b) = _tmp_lo;		\
} while (0)

/* 128 bit interleaves. */
#define u8x16_interleave(a,b) _vector_interleave(a,b,u8x16)
#define i8x16_interleave(a,b) _vector_interleave(a,b,i8x16)
#define u16x8_interleave(a,b) _vector_interleave(a,b,u16x8)
#define i16x8_interleave(a,b) _vector_interleave(a,b,i16x8)
#define u32x4_interleave(a,b) _vector_interleave(a,b,u32x4)
#define i32x4_interleave(a,b) _vector_interleave(a,b,i32x4)
#define u64x2_interleave(a,b) _vector_interleave(a,b,u64x2)
#define i64x2_interleave(a,b) _vector_interleave(a,b,i64x2)

/* 64 bit interleaves. */
#define u8x8_interleave(a,b) _vector_interleave(a,b,u8x8)
#define i8x8_interleave(a,b) _vector_interleave(a,b,i8x8)
#define u16x4_interleave(a,b) _vector_interleave(a,b,u16x4)
#define i16x4_interleave(a,b) _vector_interleave(a,b,i16x4)
#define u32x2_interleave(a,b) _vector_interleave(a,b,u32x2)
#define i32x2_interleave(a,b) _vector_interleave(a,b,i32x2)

/* Word sized interleaves. */
#if CLIB_VECTOR_WORD_BITS == 128
#define u8x_interleave u8x16_interleave
#define u16x_interleave u16x8_interleave
#define u32x_interleave u32x4_interleave
#define u64x_interleave u64x2_interleave
#endif

#if CLIB_VECTOR_WORD_BITS == 64
#define u8x_interleave u8x8_interleave
#define u16x_interleave u16x4_interleave
#define u32x_interleave u32x2_interleave
#define u64x_interleave(a,b)	/* do nothing */
#endif

/* Vector word sized shifts. */
#if CLIB_VECTOR_WORD_BITS == 128
#define u8x_shift_left u8x16_shift_left
#define i8x_shift_left i8x16_shift_left
#define u16x_shift_left u16x8_shift_left
#define i16x_shift_left i16x8_shift_left
#define u32x_shift_left u32x4_shift_left
#define i32x_shift_left i32x4_shift_left
#define u64x_shift_left u64x2_shift_left
#define i64x_shift_left i64x2_shift_left
#define u8x_shift_right u8x16_shift_right
#define i8x_shift_right i8x16_shift_right
#define u16x_shift_right u16x8_shift_right
#define i16x_shift_right i16x8_shift_right
#define u32x_shift_right u32x4_shift_right
#define i32x_shift_right i32x4_shift_right
#define u64x_shift_right u64x2_shift_right
#define i64x_shift_right i64x2_shift_right
#define u8x_rotate_left u8x16_rotate_left
#define i8x_rotate_left i8x16_rotate_left
#define u16x_rotate_left u16x8_rotate_left
#define i16x_rotate_left i16x8_rotate_left
#define u32x_rotate_left u32x4_rotate_left
#define i32x_rotate_left i32x4_rotate_left
#define u64x_rotate_left u64x2_rotate_left
#define i64x_rotate_left i64x2_rotate_left
#define u8x_rotate_right u8x16_rotate_right
#define i8x_rotate_right i8x16_rotate_right
#define u16x_rotate_right u16x8_rotate_right
#define i16x_rotate_right i16x8_rotate_right
#define u32x_rotate_right u32x4_rotate_right
#define i32x_rotate_right i32x4_rotate_right
#define u64x_rotate_right u64x2_rotate_right
#define i64x_rotate_right i64x2_rotate_right
#define u8x_ishift_left u8x16_ishift_left
#define i8x_ishift_left i8x16_ishift_left
#define u16x_ishift_left u16x8_ishift_left
#define i16x_ishift_left i16x8_ishift_left
#define u32x_ishift_left u32x4_ishift_left
#define i32x_ishift_left i32x4_ishift_left
#define u64x_ishift_left u64x2_ishift_left
#define i64x_ishift_left i64x2_ishift_left
#define u8x_ishift_right u8x16_ishift_right
#define i8x_ishift_right i8x16_ishift_right
#define u16x_ishift_right u16x8_ishift_right
#define i16x_ishift_right i16x8_ishift_right
#define u32x_ishift_right u32x4_ishift_right
#define i32x_ishift_right i32x4_ishift_right
#define u64x_ishift_right u64x2_ishift_right
#define i64x_ishift_right i64x2_ishift_right
#define u8x_irotate_left u8x16_irotate_left
#define i8x_irotate_left i8x16_irotate_left
#define u16x_irotate_left u16x8_irotate_left
#define i16x_irotate_left i16x8_irotate_left
#define u32x_irotate_left u32x4_irotate_left
#define i32x_irotate_left i32x4_irotate_left
#define u64x_irotate_left u64x2_irotate_left
#define i64x_irotate_left i64x2_irotate_left
#define u8x_irotate_right u8x16_irotate_right
#define i8x_irotate_right i8x16_irotate_right
#define u16x_irotate_right u16x8_irotate_right
#define i16x_irotate_right i16x8_irotate_right
#define u32x_irotate_right u32x4_irotate_right
#define i32x_irotate_right i32x4_irotate_right
#define u64x_irotate_right u64x2_irotate_right
#define i64x_irotate_right i64x2_irotate_right
#endif

#if CLIB_VECTOR_WORD_BITS == 64
#define u8x_shift_left u8x8_shift_left
#define i8x_shift_left i8x8_shift_left
#define u16x_shift_left u16x4_shift_left
#define i16x_shift_left i16x4_shift_left
#define u32x_shift_left u32x2_shift_left
#define i32x_shift_left i32x2_shift_left
#define u8x_shift_right u8x8_shift_right
#define i8x_shift_right i8x8_shift_right
#define u16x_shift_right u16x4_shift_right
#define i16x_shift_right i16x4_shift_right
#define u32x_shift_right u32x2_shift_right
#define i32x_shift_right i32x2_shift_right
#define u8x_rotate_left u8x8_rotate_left
#define i8x_rotate_left i8x8_rotate_left
#define u16x_rotate_left u16x4_rotate_left
#define i16x_rotate_left i16x4_rotate_left
#define u32x_rotate_left u32x2_rotate_left
#define i32x_rotate_left i32x2_rotate_left
#define u8x_rotate_right u8x8_rotate_right
#define i8x_rotate_right i8x8_rotate_right
#define u16x_rotate_right u16x4_rotate_right
#define i16x_rotate_right i16x4_rotate_right
#define u32x_rotate_right u32x2_rotate_right
#define i32x_rotate_right i32x2_rotate_right
#define u8x_ishift_left u8x8_ishift_left
#define i8x_ishift_left i8x8_ishift_left
#define u16x_ishift_left u16x4_ishift_left
#define i16x_ishift_left i16x4_ishift_left
#define u32x_ishift_left u32x2_ishift_left
#define i32x_ishift_left i32x2_ishift_left
#define u8x_ishift_right u8x8_ishift_right
#define i8x_ishift_right i8x8_ishift_right
#define u16x_ishift_right u16x4_ishift_right
#define i16x_ishift_right i16x4_ishift_right
#define u32x_ishift_right u32x2_ishift_right
#define i32x_ishift_right i32x2_ishift_right
#define u8x_irotate_left u8x8_irotate_left
#define i8x_irotate_left i8x8_irotate_left
#define u16x_irotate_left u16x4_irotate_left
#define i16x_irotate_left i16x4_irotate_left
#define u32x_irotate_left u32x2_irotate_left
#define i32x_irotate_left i32x2_irotate_left
#define u8x_irotate_right u8x8_irotate_right
#define i8x_irotate_right i8x8_irotate_right
#define u16x_irotate_right u16x4_irotate_right
#define i16x_irotate_right i16x4_irotate_right
#define u32x_irotate_right u32x2_irotate_right
#define i32x_irotate_right i32x2_irotate_right
#endif

#if CLIB_VECTOR_WORD_BITS == 128
#define u8x_splat u8x16_splat
#define i8x_splat i8x16_splat
#define u16x_splat u16x8_splat
#define i16x_splat i16x8_splat
#define u32x_splat u32x4_splat
#define i32x_splat i32x4_splat
#define u64x_splat u64x2_splat
#define i64x_splat i64x2_splat
#endif

#if CLIB_VECTOR_WORD_BITS == 64
#define u8x_splat u8x8_splat
#define i8x_splat i8x8_splat
#define u16x_splat u16x4_splat
#define i16x_splat i16x4_splat
#define u32x_splat u32x2_splat
#define i32x_splat i32x2_splat
#endif

#define u32x4_transpose_step(x,y)		\
do {						\
  u32x4 _x = (x);				\
  u32x4 _y = (y);				\
  (x) = u32x4_interleave_lo (_x, _y);		\
  (y) = u32x4_interleave_hi (_x, _y);		\
} while (0)

/* 4x4 transpose: x_ij -> x_ji */
#define u32x4_transpose(x0,x1,x2,x3)		\
do {						\
  u32x4 _x0 = (u32x4) (x0);			\
  u32x4 _x1 = (u32x4) (x1);			\
  u32x4 _x2 = (u32x4) (x2);			\
  u32x4 _x3 = (u32x4) (x3);			\
  u32x4_transpose_step (_x0, _x2);		\
  u32x4_transpose_step (_x1, _x3);		\
  u32x4_transpose_step (_x0, _x1);		\
  u32x4_transpose_step (_x2, _x3);		\
  (x0) = (u32x4) _x0;				\
  (x1) = (u32x4) _x1;				\
  (x2) = (u32x4) _x2;				\
  (x3) = (u32x4) _x3;				\
} while (0)

#define i32x4_transpose(x0,x1,x2,x3)		\
do {						\
  u32x4 _x0 = (u32x4) (x0);			\
  u32x4 _x1 = (u32x4) (x1);			\
  u32x4 _x2 = (u32x4) (x2);			\
  u32x4 _x3 = (u32x4) (x3);			\
  u32x4_transpose_step (_x0, _x2);		\
  u32x4_transpose_step (_x1, _x3);		\
  u32x4_transpose_step (_x0, _x1);		\
  u32x4_transpose_step (_x2, _x3);		\
  (x0) = (i32x4) _x0;				\
  (x1) = (i32x4) _x1;				\
  (x2) = (i32x4) _x2;				\
  (x3) = (i32x4) _x3;				\
} while (0)

#undef _

#endif /* included_vector_funcs_h */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */