1 /* 2 3 BLIS 4 An object-based framework for developing high-performance BLAS-like 5 libraries. 6 7 Copyright (C) 2014, The University of Texas at Austin 8 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(s) of the copyright holder(s) nor the names of its 18 contributors may be used to endorse or promote products derived 19 from this software without specific prior written permission. 20 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. 32 33 */ 34 35 #include "blis.h" 36 37 #undef GENTFUNC 38 #define GENTFUNC( ctype, ch, opname, arch, suf ) \ 39 \ 40 void PASTEMAC3(ch,opname,arch,suf) \ 41 ( \ 42 conj_t conjx, \ 43 conj_t conjy, \ 44 dim_t n, \ 45 ctype* restrict x, inc_t incx, \ 46 ctype* restrict y, inc_t incy, \ 47 ctype* restrict rho, \ 48 cntx_t* restrict cntx \ 49 ) \ 50 { \ 51 ctype dotxy; \ 52 \ 53 if ( bli_zero_dim1( n ) ) \ 54 { \ 55 PASTEMAC(ch,set0s)( *rho ); \ 56 return; \ 57 } \ 58 \ 59 PASTEMAC(ch,set0s)( dotxy ); \ 60 \ 61 conj_t conjx_use = conjx; \ 62 \ 63 /* If y must be conjugated, we do so indirectly by first toggling the 64 effective conjugation of x and then conjugating the resulting dot 65 product. */ \ 66 if ( bli_is_conj( conjy ) ) \ 67 bli_toggle_conj( &conjx_use ); \ 68 \ 69 if ( bli_is_conj( conjx_use ) ) \ 70 { \ 71 if ( incx == 1 && incy == 1 ) \ 72 { \ 73 PRAGMA_SIMD \ 74 for ( dim_t i = 0; i < n; ++i ) \ 75 { \ 76 PASTEMAC(ch,dotjs)( x[i], y[i], dotxy ); \ 77 } \ 78 } \ 79 else \ 80 { \ 81 for ( dim_t i = 0; i < n; ++i ) \ 82 { \ 83 PASTEMAC(ch,dotjs)( *x, *y, dotxy ); \ 84 \ 85 x += incx; \ 86 y += incy; \ 87 } \ 88 } \ 89 } \ 90 else \ 91 { \ 92 if ( incx == 1 && incy == 1 ) \ 93 { \ 94 PRAGMA_SIMD \ 95 for ( dim_t i = 0; i < n; ++i ) \ 96 { \ 97 PASTEMAC(ch,dots)( x[i], y[i], dotxy ); \ 98 } \ 99 } \ 100 else \ 101 { \ 102 for ( dim_t i = 0; i < n; ++i ) \ 103 { \ 104 PASTEMAC(ch,dots)( *x, *y, dotxy ); \ 105 \ 106 x += incx; \ 107 y += incy; \ 108 } \ 109 } \ 110 } \ 111 \ 112 if ( bli_is_conj( conjy ) ) \ 113 PASTEMAC(ch,conjs)( dotxy ); \ 114 \ 115 PASTEMAC(ch,copys)( dotxy, *rho ); \ 116 } 117 118 INSERT_GENTFUNC_BASIC2( dotv, BLIS_CNAME_INFIX, BLIS_REF_SUFFIX ) 119 120