Update contrib.
2 * LIBOIL - Library of Optimized Inner Loops
3 * Copyright (c) 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.
35 #include <liboil/liboilfunction.h>
37 OIL_DECLARE_CLASS (copy_u8);
40 copy_u8_libc (uint8_t *dest, const uint8_t *src, int n)
42 memcpy (dest, src, n);
44 OIL_DEFINE_IMPL (copy_u8_libc, copy_u8);
47 copy_u8_ptr (uint8_t *dest, const uint8_t *src, int n)
53 OIL_DEFINE_IMPL (copy_u8_ptr, copy_u8);
55 #ifdef HAVE_UNALIGNED_ACCESS
57 copy_u8_ints (uint8_t *dest, const uint8_t *src, int n)
65 *(uint32_t *)dest = *(uint32_t *)src;
70 OIL_DEFINE_IMPL (copy_u8_ints, copy_u8);
73 #ifdef HAVE_UNALIGNED_ACCESS
74 /* Submitted by Adam Moss */
76 copy_u8_llints (uint8_t *dest, const uint8_t *src, int n)
84 *(uint64_t *)dest = *(uint64_t *)src;
89 OIL_DEFINE_IMPL (copy_u8_llints, copy_u8);
92 #ifdef HAVE_UNALIGNED_ACCESS
93 /* Submitted by Adam Moss */
95 copy_u8_llints_duff (uint8_t *dest, const uint8_t *src, int n)
98 case 7: *dest++ = *src++;
99 case 6: *dest++ = *src++;
100 case 5: *dest++ = *src++;
101 case 4: *dest++ = *src++;
102 case 3: *dest++ = *src++;
103 case 2: *dest++ = *src++;
104 case 1: *dest++ = *src++;
111 case 0: *(uint64_t *)dest = *(uint64_t *)src; dest += 8; src += 8;
112 case 15: *(uint64_t *)dest = *(uint64_t *)src; dest += 8; src += 8;
113 case 14: *(uint64_t *)dest = *(uint64_t *)src; dest += 8; src += 8;
114 case 13: *(uint64_t *)dest = *(uint64_t *)src; dest += 8; src += 8;
115 case 12: *(uint64_t *)dest = *(uint64_t *)src; dest += 8; src += 8;
116 case 11: *(uint64_t *)dest = *(uint64_t *)src; dest += 8; src += 8;
117 case 10: *(uint64_t *)dest = *(uint64_t *)src; dest += 8; src += 8;
118 case 9: *(uint64_t *)dest = *(uint64_t *)src; dest += 8; src += 8;
119 case 8: *(uint64_t *)dest = *(uint64_t *)src; dest += 8; src += 8;
120 case 7: *(uint64_t *)dest = *(uint64_t *)src; dest += 8; src += 8;
121 case 6: *(uint64_t *)dest = *(uint64_t *)src; dest += 8; src += 8;
122 case 5: *(uint64_t *)dest = *(uint64_t *)src; dest += 8; src += 8;
123 case 4: *(uint64_t *)dest = *(uint64_t *)src; dest += 8; src += 8;
124 case 3: *(uint64_t *)dest = *(uint64_t *)src; dest += 8; src += 8;
125 case 2: *(uint64_t *)dest = *(uint64_t *)src; dest += 8; src += 8;
126 case 1: *(uint64_t *)dest = *(uint64_t *)src; dest += 8; src += 8;
128 n = (n - 1) & ~(int)15;
131 OIL_DEFINE_IMPL (copy_u8_llints_duff, copy_u8);
138 OilFunctionImpl* __oil_function_impl_copy_u8_libc() {
139 return &_oil_function_impl_copy_u8_libc;
145 OilFunctionImpl* __oil_function_impl_copy_u8_ptr() {
146 return &_oil_function_impl_copy_u8_ptr;
150 #ifdef HAVE_UNALIGNED_ACCESS
153 OilFunctionImpl* __oil_function_impl_copy_u8_ints() {
154 return &_oil_function_impl_copy_u8_ints;
159 #ifdef HAVE_UNALIGNED_ACCESS
162 OilFunctionImpl* __oil_function_impl_copy_u8_llints() {
163 return &_oil_function_impl_copy_u8_llints;
168 #ifdef HAVE_UNALIGNED_ACCESS
171 OilFunctionImpl* __oil_function_impl_copy_u8_llints_duff() {
172 return &_oil_function_impl_copy_u8_llints_duff;