38 #ifndef included_vector_altivec_h 39 #define included_vector_altivec_h 42 #define _(t,ti,lr,f) \ 43 always_inline t t##_##lr (t x, t y) \ 44 { return (t) __builtin_altivec_##f ((ti) x, (ti) y); } \ 46 always_inline t t##_i##lr (t x, int i) \ 49 return t##_##lr (x, j); \ 52 _(u16x8, i16x8, shift_left, vslh);
53 _(u32x4, i32x4, shift_left, vslw);
54 _(u16x8, i16x8, shift_right, vsrh);
55 _(u32x4, i32x4, shift_right, vsrw);
56 _(i16x8, i16x8, shift_right, vsrah);
57 _(i32x4, i32x4, shift_right, vsraw);
65 #define _(t,it,lr,f) \ 66 always_inline t t##_word_shift_##lr (t x, int n_words) \ 68 i32x4 n_bits = {0,0,0,n_words * BITS (it)}; \ 69 return (t) __builtin_altivec_##f ((i32x4) x, n_bits); \ 72 _(u32x4, u32, left, vslo)
73 _(i32x4, i32, left, vslo)
74 _(u32x4, u32, right, vsro)
75 _(i32x4, i32, right, vsro)
76 _(u16x8, u16, left, vslo)
77 _(i16x8, i16, left, vslo)
78 _(u16x8, u16, right, vsro) _(i16x8, i16, right, vsro)
90 #define _(t,it,lh,f) \ 91 always_inline t t##_interleave_##lh (t x, t y) \ 92 { return (t) __builtin_altivec_##f ((it) x, (it) y); } 94 _(u32x4, i32x4, lo, vmrglw)
95 _(i32x4, i32x4, lo, vmrglw)
96 _(u16x8, i16x8, lo, vmrglh)
97 _(i16x8, i16x8, lo, vmrglh)
98 _(u32x4, i32x4, hi, vmrghw)
99 _(i32x4, i32x4, hi, vmrghw)
100 _(u16x8, i16x8, hi, vmrghh) _(i16x8, i16x8, hi, vmrghh)
105 always_inline void t##_store_unaligned (t x, t * a) \ 106 { clib_mem_unaligned (a, t) = x; } \ 107 always_inline t t##_load_unaligned (t * a) \ 108 { return clib_mem_unaligned (a, t); } 109 _(u8x16) _(u16x8) _(u32x4) _(u64x2) _(i8x16) _(i16x8) _(i32x4) _(i64x2)
112 #define _signed_binop(n,m,f,g) \ 114 always_inline u##n##x##m \ 115 u##n##x##m##_##f (u##n##x##m x, u##n##x##m y) \ 116 { return (u##n##x##m) __builtin_altivec_##g ((i##n##x##m) x, (i##n##x##m) y); } \ 119 always_inline i##n##x##m \ 120 i##n##x##m##_##f (i##n##x##m x, i##n##x##m y) \ 121 { return (i##n##x##m) __builtin_altivec_##g ((i##n##x##m) x, (i##n##x##m) y); } 123 _signed_binop (16, 8, is_equal, vcmpequh)
124 _signed_binop (32, 4, is_equal, vcmpequw)
129 return u16x8_is_equal (x, zero);
135 u32x4 cmp = u32x4_is_zero (x);
136 u32x4 tmp = { 0x000f, 0x00f0, 0x0f00, 0xf000, };
adds_epu subs_epu i16x8 y
#define u32x4_word_shift_right(a, n)
vslo vsro vslo static vsro u32 u32x4_get0(u32x4 x)
static uword rotate_left(uword x, uword i)
static u32 u32x4_zero_byte_mask(u32x4 x)