2 * Copyright (c) 2015 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 Copyright (c) 2008 Eliot Dresselhaus
18 Permission is hereby granted, free of charge, to any person obtaining
19 a copy of this software and associated documentation files (the
20 "Software"), to deal in the Software without restriction, including
21 without limitation the rights to use, copy, modify, merge, publish,
22 distribute, sublicense, and/or sell copies of the Software, and to
23 permit persons to whom the Software is furnished to do so, subject to
24 the following conditions:
26 The above copyright notice and this permission notice shall be
27 included in all copies or substantial portions of the Software.
29 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
30 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
32 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
33 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
34 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
35 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38 #ifndef included_vector_iwmmxt_h
39 #define included_vector_iwmmxt_h
41 #include <vppinfra/error.h> /* for ASSERT */
43 /* 64 bit interleaves. */
45 u8x8_interleave_hi (u8x8 a, u8x8 b)
47 return __builtin_arm_wunpckihb (a, b);
51 u8x8_interleave_lo (u8x8 a, u8x8 b)
53 return __builtin_arm_wunpckilb (a, b);
57 u16x4_interleave_hi (u16x4 a, u16x4 b)
59 return __builtin_arm_wunpckihh (a, b);
63 u16x4_interleave_lo (u16x4 a, u16x4 b)
65 return __builtin_arm_wunpckilh (a, b);
69 u32x2_interleave_hi (u32x2 a, u32x2 b)
71 return __builtin_arm_wunpckihw (a, b);
75 u32x2_interleave_lo (u32x2 a, u32x2 b)
77 return __builtin_arm_wunpckilw (a, b);
84 x = u32x2_interleave_lo (x, x);
91 u32 t = (u32) a | ((u32) a << 16);
92 return u32x2_splat (t);
98 u32 t = (u32) a | ((u32) a << 8);
100 return u32x2_splat (t);
103 #define i32x2_splat u32x2_splat
104 #define i16x4_splat u16x4_splat
105 #define i8x8_splat u8x8_splat
109 /* As of July 2008 the __builtin_arm shifts cause gcc-4.3.1 to crash
110 so we use asm versions. */
111 #define _(t,u,lr,f) \
113 t##_##lr (t x, int i) \
116 asm (#f " %[y], %[x], %[shift]" \
118 : [x] "y" (x), [shift] "i" (i * u)); \
122 _(u16x4, 1, shift_left, wsllhi)
123 _(u32x2, 1, shift_left, wsllwi)
124 _(u16x4, 1, shift_right, wsrlhi)
125 _(u32x2, 1, shift_right, wsrlwi)
126 _(i16x4, 1, shift_left, wsllhi)
127 _(i32x2, 1, shift_left, wsllwi)
128 _(i16x4, 1, shift_right, wsrahi) _(i32x2, 1, shift_right, wsrawi)
130 _(u8x8, 8, word_shift_left, wslldi)
131 _(u16x4, 16, word_shift_left, wslldi)
132 _(u32x2, 32, word_shift_left, wslldi)
133 _(u8x8, 8, word_shift_right, wsrldi)
134 _(u16x4, 16, word_shift_right, wsrldi)
135 _(u32x2, 32, word_shift_right, wsrldi)
136 _(i8x8, 8, word_shift_left, wslldi)
137 _(i16x4, 16, word_shift_left, wslldi)
138 _(i32x2, 32, word_shift_left, wslldi)
139 _(i8x8, 8, word_shift_right, wsrldi)
140 _(i16x4, 16, word_shift_right, wsrldi) _(i32x2, 32, word_shift_right, wsrldi)
142 #endif /* included_vector_iwmmxt_h */
144 * fd.io coding-style-patch-verification: ON
147 * eval: (c-set-style "gnu")