Update contrib.
2 * LIBOIL - Library of Optimized Inner Loops
3 * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
19 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
27 //Portions Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
33 #include <liboil/liboilfunction.h>
34 #include <liboil/liboiltest.h>
35 #include "liboil/simdpack/simdpack.h"
39 permute_test (OilTest *test)
43 int stride = oil_test_get_value (test, OIL_ARG_SSTR2);
44 uint8_t *ptr = (uint8_t *) oil_test_get_source_data (test, OIL_ARG_SRC2);
48 OIL_GET(ptr, i*stride, int32_t) = 0; /* oil_rand_s32(); */
53 #define PERMUTE_DEFINE_REF(type) \
54 static void permute_ ## type ## _ref( \
55 oil_type_ ## type *dest, int dstr, \
56 oil_type_ ## type *src1, int sstr1, \
57 int32_t *src2, int sstr2, int n) \
61 OIL_GET(dest,dstr*i, oil_type_ ## type) = OIL_GET(src1,sstr1* \
62 OIL_GET(src2,sstr2*i, int), oil_type_ ## type); \
65 OIL_DEFINE_IMPL_REF (permute_ ## type ## _ref, permute_ ## type); \
66 OIL_DEFINE_CLASS_FULL (permute_ ## type, "oil_type_" #type " *dest, int dstr, " \
67 "oil_type_" #type " *src1, int sstr1, int32_t *src2, int sstr2, int n", \
80 * Copies elements in @src1 to @dest, permuting them by @src2. That is,
81 * @dest[i] is set to @src1[@src2[i]]. Values in @src2 must be
82 * non-negative and less than @n.
84 PERMUTE_DEFINE_REF (s8);
95 * Copies elements in @src1 to @dest, permuting them by @src2. That is,
96 * @dest[i] is set to @src1[@src2[i]]. Values in @src2 must be
97 * non-negative and less than @n.
99 PERMUTE_DEFINE_REF (u8);
110 * Copies elements in @src1 to @dest, permuting them by @src2. That is,
111 * @dest[i] is set to @src1[@src2[i]]. Values in @src2 must be
112 * non-negative and less than @n.
114 PERMUTE_DEFINE_REF (s16);
125 * Copies elements in @src1 to @dest, permuting them by @src2. That is,
126 * @dest[i] is set to @src1[@src2[i]]. Values in @src2 must be
127 * non-negative and less than @n.
129 PERMUTE_DEFINE_REF (u16);
140 * Copies elements in @src1 to @dest, permuting them by @src2. That is,
141 * @dest[i] is set to @src1[@src2[i]]. Values in @src2 must be
142 * non-negative and less than @n.
144 PERMUTE_DEFINE_REF (s32);
155 * Copies elements in @src1 to @dest, permuting them by @src2. That is,
156 * @dest[i] is set to @src1[@src2[i]]. Values in @src2 must be
157 * non-negative and less than @n.
159 PERMUTE_DEFINE_REF (u32);
170 * Copies elements in @src1 to @dest, permuting them by @src2. That is,
171 * @dest[i] is set to @src1[@src2[i]]. Values in @src2 must be
172 * non-negative and less than @n.
174 PERMUTE_DEFINE_REF (f32);
185 * Copies elements in @src1 to @dest, permuting them by @src2. That is,
186 * @dest[i] is set to @src1[@src2[i]]. Values in @src2 must be
187 * non-negative and less than @n.
189 PERMUTE_DEFINE_REF (f64);
194 OilFunctionClass* __oil_function_class_permute_f32()
196 return &_oil_function_class_permute_f32;
202 OilFunctionClass* __oil_function_class_permute_f64()
204 return &_oil_function_class_permute_f64;
211 OilFunctionClass* __oil_function_class_permute_s16()
213 return &_oil_function_class_permute_s16;
219 OilFunctionClass* __oil_function_class_permute_s32()
221 return &_oil_function_class_permute_s32;
227 OilFunctionClass* __oil_function_class_permute_s8()
229 return &_oil_function_class_permute_s8;
235 OilFunctionClass* __oil_function_class_permute_u16()
237 return &_oil_function_class_permute_u16;
243 OilFunctionClass* __oil_function_class_permute_u32()
245 return &_oil_function_class_permute_u32;
251 OilFunctionClass* __oil_function_class_permute_u8()
253 return &_oil_function_class_permute_u8;
261 OilFunctionImpl* __oil_function_impl_permute_s8_ref() {
262 return &_oil_function_impl_permute_s8_ref;
268 OilFunctionImpl* __oil_function_impl_permute_u8_ref() {
269 return &_oil_function_impl_permute_u8_ref;
275 OilFunctionImpl* __oil_function_impl_permute_s16_ref() {
276 return &_oil_function_impl_permute_s16_ref;
282 OilFunctionImpl* __oil_function_impl_permute_u16_ref() {
283 return &_oil_function_impl_permute_u16_ref;
289 OilFunctionImpl* __oil_function_impl_permute_s32_ref() {
290 return &_oil_function_impl_permute_s32_ref;
296 OilFunctionImpl* __oil_function_impl_permute_u32_ref() {
297 return &_oil_function_impl_permute_u32_ref;
303 OilFunctionImpl* __oil_function_impl_permute_f32_ref() {
304 return &_oil_function_impl_permute_f32_ref;
310 OilFunctionImpl* __oil_function_impl_permute_f64_ref() {
311 return &_oil_function_impl_permute_f64_ref;