os/ossrv/genericopenlibs/liboil/src/deprecated/permute_c_dep.c
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/liboil/src/deprecated/permute_c_dep.c	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,314 @@
     1.4 +/*
     1.5 + * LIBOIL - Library of Optimized Inner Loops
     1.6 + * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
     1.7 + * All rights reserved.
     1.8 + *
     1.9 + * Redistribution and use in source and binary forms, with or without
    1.10 + * modification, are permitted provided that the following conditions
    1.11 + * are met:
    1.12 + * 1. Redistributions of source code must retain the above copyright
    1.13 + *    notice, this list of conditions and the following disclaimer.
    1.14 + * 2. Redistributions in binary form must reproduce the above copyright
    1.15 + *    notice, this list of conditions and the following disclaimer in the
    1.16 + *    documentation and/or other materials provided with the distribution.
    1.17 + * 
    1.18 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    1.19 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    1.20 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.21 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
    1.22 + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    1.23 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    1.24 + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.25 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
    1.26 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
    1.27 + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    1.28 + * POSSIBILITY OF SUCH DAMAGE.
    1.29 + */
    1.30 +//Portions Copyright (c)  2008-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 
    1.31 +
    1.32 +#ifdef HAVE_CONFIG_H
    1.33 +#include "config.h"
    1.34 +#endif
    1.35 +
    1.36 +#include <liboil/liboilfunction.h>
    1.37 +#include <liboil/liboiltest.h>
    1.38 +#include "liboil/simdpack/simdpack.h"
    1.39 +#include <math.h>
    1.40 +
    1.41 +static void
    1.42 +permute_test (OilTest *test)
    1.43 +{
    1.44 +  int i;
    1.45 +  int n = test->n;
    1.46 +  int stride = oil_test_get_value (test, OIL_ARG_SSTR2);
    1.47 +  uint8_t *ptr = (uint8_t *) oil_test_get_source_data (test, OIL_ARG_SRC2);
    1.48 +
    1.49 +  for(i=0;i<n;i++){
    1.50 +    /* FIXME */
    1.51 +    OIL_GET(ptr, i*stride, int32_t) = 0; /* oil_rand_s32(); */
    1.52 +  }
    1.53 +
    1.54 +}
    1.55 +
    1.56 +#define PERMUTE_DEFINE_REF(type)		\
    1.57 +static void permute_ ## type ## _ref(		\
    1.58 +    oil_type_ ## type *dest, int dstr,		\
    1.59 +    oil_type_ ## type *src1, int sstr1,		\
    1.60 +    int32_t *src2, int sstr2, int n)		\
    1.61 +{						\
    1.62 +  int i;					\
    1.63 +  for(i=0;i<n;i++){				\
    1.64 +    OIL_GET(dest,dstr*i, oil_type_ ## type) = OIL_GET(src1,sstr1*	\
    1.65 +	OIL_GET(src2,sstr2*i, int), oil_type_ ## type);		\
    1.66 +  }						\
    1.67 +}						\
    1.68 +OIL_DEFINE_IMPL_REF (permute_ ## type ## _ref, permute_ ## type); \
    1.69 +OIL_DEFINE_CLASS_FULL (permute_ ## type, "oil_type_" #type " *dest, int dstr, " \
    1.70 +    "oil_type_" #type " *src1, int sstr1, int32_t *src2, int sstr2, int n", \
    1.71 +    permute_test)
    1.72 +
    1.73 +/**
    1.74 + * oil_permute_s8:
    1.75 + * @dest:
    1.76 + * @dstr:
    1.77 + * @src1:
    1.78 + * @sstr1:
    1.79 + * @src2:
    1.80 + * @sstr2:
    1.81 + * @n:
    1.82 + *
    1.83 + * Copies elements in @src1 to @dest, permuting them by @src2.  That is,
    1.84 + * @dest[i] is set to @src1[@src2[i]].  Values in @src2 must be
    1.85 + * non-negative and less than @n.
    1.86 + */
    1.87 +PERMUTE_DEFINE_REF (s8);
    1.88 +/**
    1.89 + * oil_permute_u8:
    1.90 + * @dest:
    1.91 + * @dstr:
    1.92 + * @src1:
    1.93 + * @sstr1:
    1.94 + * @src2:
    1.95 + * @sstr2:
    1.96 + * @n:
    1.97 + *
    1.98 + * Copies elements in @src1 to @dest, permuting them by @src2.  That is,
    1.99 + * @dest[i] is set to @src1[@src2[i]].  Values in @src2 must be
   1.100 + * non-negative and less than @n.
   1.101 + */
   1.102 +PERMUTE_DEFINE_REF (u8);
   1.103 +/**
   1.104 + * oil_permute_s16:
   1.105 + * @dest:
   1.106 + * @dstr:
   1.107 + * @src1:
   1.108 + * @sstr1:
   1.109 + * @src2:
   1.110 + * @sstr2:
   1.111 + * @n:
   1.112 + *
   1.113 + * Copies elements in @src1 to @dest, permuting them by @src2.  That is,
   1.114 + * @dest[i] is set to @src1[@src2[i]].  Values in @src2 must be
   1.115 + * non-negative and less than @n.
   1.116 + */
   1.117 +PERMUTE_DEFINE_REF (s16);
   1.118 +/**
   1.119 + * oil_permute_u16:
   1.120 + * @dest:
   1.121 + * @dstr:
   1.122 + * @src1:
   1.123 + * @sstr1:
   1.124 + * @src2:
   1.125 + * @sstr2:
   1.126 + * @n:
   1.127 + *
   1.128 + * Copies elements in @src1 to @dest, permuting them by @src2.  That is,
   1.129 + * @dest[i] is set to @src1[@src2[i]].  Values in @src2 must be
   1.130 + * non-negative and less than @n.
   1.131 + */
   1.132 +PERMUTE_DEFINE_REF (u16);
   1.133 +/**
   1.134 + * oil_permute_s32:
   1.135 + * @dest:
   1.136 + * @dstr:
   1.137 + * @src1:
   1.138 + * @sstr1:
   1.139 + * @src2:
   1.140 + * @sstr2:
   1.141 + * @n:
   1.142 + *
   1.143 + * Copies elements in @src1 to @dest, permuting them by @src2.  That is,
   1.144 + * @dest[i] is set to @src1[@src2[i]].  Values in @src2 must be
   1.145 + * non-negative and less than @n.
   1.146 + */
   1.147 +PERMUTE_DEFINE_REF (s32);
   1.148 +/**
   1.149 + * oil_permute_u32:
   1.150 + * @dest:
   1.151 + * @dstr:
   1.152 + * @src1:
   1.153 + * @sstr1:
   1.154 + * @src2:
   1.155 + * @sstr2:
   1.156 + * @n:
   1.157 + *
   1.158 + * Copies elements in @src1 to @dest, permuting them by @src2.  That is,
   1.159 + * @dest[i] is set to @src1[@src2[i]].  Values in @src2 must be
   1.160 + * non-negative and less than @n.
   1.161 + */
   1.162 +PERMUTE_DEFINE_REF (u32);
   1.163 +/**
   1.164 + * oil_permute_f32:
   1.165 + * @dest:
   1.166 + * @dstr:
   1.167 + * @src1:
   1.168 + * @sstr1:
   1.169 + * @src2:
   1.170 + * @sstr2:
   1.171 + * @n:
   1.172 + *
   1.173 + * Copies elements in @src1 to @dest, permuting them by @src2.  That is,
   1.174 + * @dest[i] is set to @src1[@src2[i]].  Values in @src2 must be
   1.175 + * non-negative and less than @n.
   1.176 + */
   1.177 +PERMUTE_DEFINE_REF (f32);
   1.178 +/**
   1.179 + * oil_permute_f64:
   1.180 + * @dest:
   1.181 + * @dstr:
   1.182 + * @src1:
   1.183 + * @sstr1:
   1.184 + * @src2:
   1.185 + * @sstr2:
   1.186 + * @n:
   1.187 + *
   1.188 + * Copies elements in @src1 to @dest, permuting them by @src2.  That is,
   1.189 + * @dest[i] is set to @src1[@src2[i]].  Values in @src2 must be
   1.190 + * non-negative and less than @n.
   1.191 + */
   1.192 +PERMUTE_DEFINE_REF (f64);
   1.193 +
   1.194 +#ifdef	__SYMBIAN32__
   1.195 + 
   1.196 +#endif
   1.197 +OilFunctionClass*  __oil_function_class_permute_f32()
   1.198 +{
   1.199 +return &_oil_function_class_permute_f32;
   1.200 +}
   1.201 +
   1.202 +#ifdef	__SYMBIAN32__
   1.203 + 
   1.204 +#endif
   1.205 +OilFunctionClass*  __oil_function_class_permute_f64()
   1.206 +{
   1.207 +return &_oil_function_class_permute_f64;
   1.208 +}
   1.209 +
   1.210 +
   1.211 +#ifdef	__SYMBIAN32__
   1.212 + 
   1.213 +#endif
   1.214 +OilFunctionClass*  __oil_function_class_permute_s16()
   1.215 +{
   1.216 +return &_oil_function_class_permute_s16;
   1.217 +}
   1.218 +
   1.219 +#ifdef	__SYMBIAN32__
   1.220 + 
   1.221 +#endif
   1.222 +OilFunctionClass*  __oil_function_class_permute_s32()
   1.223 +{
   1.224 +return &_oil_function_class_permute_s32;
   1.225 +}
   1.226 +
   1.227 +#ifdef	__SYMBIAN32__
   1.228 + 
   1.229 +#endif
   1.230 +OilFunctionClass*  __oil_function_class_permute_s8()
   1.231 +{
   1.232 +return &_oil_function_class_permute_s8;
   1.233 +}
   1.234 +
   1.235 +#ifdef	__SYMBIAN32__
   1.236 + 
   1.237 +#endif
   1.238 +OilFunctionClass*  __oil_function_class_permute_u16()
   1.239 +{
   1.240 +return &_oil_function_class_permute_u16;
   1.241 +}
   1.242 +
   1.243 +#ifdef	__SYMBIAN32__
   1.244 + 
   1.245 +#endif
   1.246 +OilFunctionClass*  __oil_function_class_permute_u32()
   1.247 +{
   1.248 +return &_oil_function_class_permute_u32;
   1.249 +}
   1.250 +
   1.251 +#ifdef	__SYMBIAN32__
   1.252 + 
   1.253 +#endif
   1.254 +OilFunctionClass*  __oil_function_class_permute_u8()
   1.255 +{
   1.256 +return &_oil_function_class_permute_u8;
   1.257 +}
   1.258 +
   1.259 +
   1.260 +
   1.261 +
   1.262 +#ifdef	__SYMBIAN32__
   1.263 + 
   1.264 +OilFunctionImpl* __oil_function_impl_permute_s8_ref() {
   1.265 +		return &_oil_function_impl_permute_s8_ref;
   1.266 +}
   1.267 +#endif
   1.268 +
   1.269 +#ifdef	__SYMBIAN32__
   1.270 + 
   1.271 +OilFunctionImpl* __oil_function_impl_permute_u8_ref() {
   1.272 +		return &_oil_function_impl_permute_u8_ref;
   1.273 +}
   1.274 +#endif
   1.275 +
   1.276 +#ifdef	__SYMBIAN32__
   1.277 + 
   1.278 +OilFunctionImpl* __oil_function_impl_permute_s16_ref() {
   1.279 +		return &_oil_function_impl_permute_s16_ref;
   1.280 +}
   1.281 +#endif
   1.282 +
   1.283 +#ifdef	__SYMBIAN32__
   1.284 + 
   1.285 +OilFunctionImpl* __oil_function_impl_permute_u16_ref() {
   1.286 +		return &_oil_function_impl_permute_u16_ref;
   1.287 +}
   1.288 +#endif
   1.289 +
   1.290 +#ifdef	__SYMBIAN32__
   1.291 + 
   1.292 +OilFunctionImpl* __oil_function_impl_permute_s32_ref() {
   1.293 +		return &_oil_function_impl_permute_s32_ref;
   1.294 +}
   1.295 +#endif
   1.296 +
   1.297 +#ifdef	__SYMBIAN32__
   1.298 + 
   1.299 +OilFunctionImpl* __oil_function_impl_permute_u32_ref() {
   1.300 +		return &_oil_function_impl_permute_u32_ref;
   1.301 +}
   1.302 +#endif
   1.303 +
   1.304 +#ifdef	__SYMBIAN32__
   1.305 + 
   1.306 +OilFunctionImpl* __oil_function_impl_permute_f32_ref() {
   1.307 +		return &_oil_function_impl_permute_f32_ref;
   1.308 +}
   1.309 +#endif
   1.310 +
   1.311 +#ifdef	__SYMBIAN32__
   1.312 + 
   1.313 +OilFunctionImpl* __oil_function_impl_permute_f64_ref() {
   1.314 +		return &_oil_function_impl_permute_f64_ref;
   1.315 +}
   1.316 +#endif
   1.317 +