Update contrib.
2 * LIBOIL - Library of Optimized Inner Loops
3 * Copyright (c) 2001,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.
32 #include <liboil/liboilfunction.h>
35 OIL_DECLARE_CLASS(splat_u8);
36 OIL_DECLARE_CLASS(splat_u32);
37 OIL_DECLARE_CLASS(splat_u8_ns);
38 OIL_DECLARE_CLASS(splat_u32_ns);
43 static void splat_u32_unroll2 (uint32_t *dest, int dstr, const uint32_t *param, int n)
48 OIL_INCREMENT(dest,dstr);
53 OIL_INCREMENT(dest,dstr);
55 OIL_INCREMENT(dest,dstr);
58 OIL_DEFINE_IMPL(splat_u32_unroll2, splat_u32);
60 static void splat_u32_ns_unroll2 (uint32_t *dest, const uint32_t *param, int n)
75 OIL_DEFINE_IMPL(splat_u32_ns_unroll2, splat_u32_ns);
77 static void splat_u32_ns_unroll4 (uint32_t *dest, const uint32_t *param, int n)
94 OIL_DEFINE_IMPL(splat_u32_ns_unroll4, splat_u32_ns);
96 static void splat_u8_ns_memset (uint8_t *dest, const uint8_t *param, int n)
98 memset (dest, *param, n);
100 OIL_DEFINE_IMPL(splat_u8_ns_memset, splat_u8_ns);
102 #ifdef HAVE_UNALIGNED_ACCESS
103 static void splat_u8_ns_int (uint8_t *dest, const uint8_t *param, int n)
112 p = (*param<<24) | (*param<<16) | (*param<<8) | (*param);
114 *(uint32_t *)dest = p;
119 OIL_DEFINE_IMPL(splat_u8_ns_int, splat_u8_ns);
122 #ifdef HAVE_UNALIGNED_ACCESS
123 static void splat_u8_ns_int2 (uint8_t *dest, const uint8_t *param, int n)
132 p = (*param<<24) | (*param<<16) | (*param<<8) | (*param);
134 ((uint32_t *)dest)[0] = p;
135 ((uint32_t *)dest)[1] = p;
140 OIL_DEFINE_IMPL(splat_u8_ns_int2, splat_u8_ns);
143 #ifdef HAVE_UNALIGNED_ACCESS
144 static void splat_u8_ns_int4 (uint8_t *dest, const uint8_t *param, int n)
153 p = (*param<<24) | (*param<<16) | (*param<<8) | (*param);
155 ((uint32_t *)dest)[0] = p;
156 ((uint32_t *)dest)[1] = p;
157 ((uint32_t *)dest)[2] = p;
158 ((uint32_t *)dest)[3] = p;
163 OIL_DEFINE_IMPL(splat_u8_ns_int4, splat_u8_ns);
173 OilFunctionImpl* __oil_function_impl_splat_u32_unroll2() {
174 return &_oil_function_impl_splat_u32_unroll2;
180 OilFunctionImpl* __oil_function_impl_splat_u32_ns_unroll2() {
181 return &_oil_function_impl_splat_u32_ns_unroll2;
187 OilFunctionImpl* __oil_function_impl_splat_u32_ns_unroll4() {
188 return &_oil_function_impl_splat_u32_ns_unroll4;
194 OilFunctionImpl* __oil_function_impl_splat_u8_ns_memset() {
195 return &_oil_function_impl_splat_u8_ns_memset;
199 #ifdef HAVE_UNALIGNED_ACCESS
202 OilFunctionImpl* __oil_function_impl_splat_u8_ns_int() {
203 return &_oil_function_impl_splat_u8_ns_int;
208 #ifdef HAVE_UNALIGNED_ACCESS
211 OilFunctionImpl* __oil_function_impl_splat_u8_ns_int2() {
212 return &_oil_function_impl_splat_u8_ns_int2;
217 #ifdef HAVE_UNALIGNED_ACCESS
220 OilFunctionImpl* __oil_function_impl_splat_u8_ns_int4() {
221 return &_oil_function_impl_splat_u8_ns_int4;