]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - dense-linear-algebra-libraries/linalg.git/blob - blis/frame/1/copyv/bli_copyv_kernel.c
TI Linear Algebra Library (LINALG) Rlease 1.0.0
[dense-linear-algebra-libraries/linalg.git] / blis / frame / 1 / copyv / bli_copyv_kernel.c
1 /*
3    BLIS    
4    An object-based framework for developing high-performance BLAS-like
5    libraries.
7    Copyright (C) 2014, The University of Texas at Austin
9    Redistribution and use in source and binary forms, with or without
10    modification, are permitted provided that the following conditions are
11    met:
12     - Redistributions of source code must retain the above copyright
13       notice, this list of conditions and the following disclaimer.
14     - Redistributions in binary form must reproduce the above copyright
15       notice, this list of conditions and the following disclaimer in the
16       documentation and/or other materials provided with the distribution.
17     - Neither the name of The University of Texas at Austin nor the names
18       of its contributors may be used to endorse or promote products
19       derived from this software without specific prior written permission.
21    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25    HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
35 #include "blis.h"
37 #define FUNCPTR_T copyv_fp
39 typedef void (*FUNCPTR_T)(
40                            conj_t conjx,
41                            dim_t  n,
42                            void*  x, inc_t incx,
43                            void*  y, inc_t incy
44                          );
46 // If some mixed datatype functions will not be compiled, we initialize
47 // the corresponding elements of the function array to NULL.
48 #ifdef BLIS_ENABLE_MIXED_PRECISION_SUPPORT
49 static FUNCPTR_T GENARRAY2_ALL(ftypes,copyv_kernel_void);
50 #else
51 #ifdef BLIS_ENABLE_MIXED_DOMAIN_SUPPORT
52 static FUNCPTR_T GENARRAY2_EXT(ftypes,copyv_kernel_void);
53 #else
54 static FUNCPTR_T GENARRAY2_MIN(ftypes,copyv_kernel_void);
55 #endif
56 #endif
59 void bli_copyv_kernel( obj_t*  x,
60                        obj_t*  y )
61 {
62         num_t     dt_x      = bli_obj_datatype( *x );
63         num_t     dt_y      = bli_obj_datatype( *y );
65         conj_t    conjx     = bli_obj_conj_status( *x );
66         dim_t     n         = bli_obj_vector_dim( *x );
68         inc_t     inc_x     = bli_obj_vector_inc( *x );
69         void*     buf_x     = bli_obj_buffer_at_off( *x );
71         inc_t     inc_y     = bli_obj_vector_inc( *y );
72         void*     buf_y     = bli_obj_buffer_at_off( *y );
74         FUNCPTR_T f;
76         // Index into the type combination array to extract the correct
77         // function pointer.
78         f = ftypes[dt_x][dt_y];
80         // Invoke the function.
81         f( conjx,
82            n,
83            buf_x, inc_x,
84            buf_y, inc_y );
85 }
88 #undef  GENTFUNC2
89 #define GENTFUNC2( ctype_x, ctype_y, chx, chy, varname, kername ) \
90 \
91 void PASTEMAC2(chx,chy,varname)( \
92                                  conj_t conjx, \
93                                  dim_t  n, \
94                                  void*  x, inc_t incx, \
95                                  void*  y, inc_t incy \
96                                ) \
97 { \
98         PASTEMAC2(chx,chy,kername)( conjx, \
99                                     n, \
100                                     x, incx, \
101                                     y, incy ); \
104 // Define the basic set of functions unconditionally, and then also some
105 // mixed datatype functions if requested.
106 INSERT_GENTFUNC2_BASIC( copyv_kernel_void, COPYV_KERNEL )
108 #ifdef BLIS_ENABLE_MIXED_DOMAIN_SUPPORT
109 INSERT_GENTFUNC2_MIX_D( copyv_kernel_void, COPYV_KERNEL )
110 #endif
112 #ifdef BLIS_ENABLE_MIXED_PRECISION_SUPPORT
113 INSERT_GENTFUNC2_MIX_P( copyv_kernel_void, COPYV_KERNEL )
114 #endif