|
| 1 | +/*************************************************************************** |
| 2 | +Copyright (c) 2013-2016, The OpenBLAS Project |
| 3 | +All rights reserved. |
| 4 | +Redistribution and use in source and binary forms, with or without |
| 5 | +modification, are permitted provided that the following conditions are |
| 6 | +met: |
| 7 | +1. Redistributions of source code must retain the above copyright |
| 8 | +notice, this list of conditions and the following disclaimer. |
| 9 | +2. Redistributions in binary form must reproduce the above copyright |
| 10 | +notice, this list of conditions and the following disclaimer in |
| 11 | +the documentation and/or other materials provided with the |
| 12 | +distribution. |
| 13 | +3. Neither the name of the OpenBLAS project nor the names of |
| 14 | +its contributors may be used to endorse or promote products |
| 15 | +derived from this software without specific prior written permission. |
| 16 | +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 17 | +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 18 | +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 19 | +ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBLAS PROJECT OR CONTRIBUTORS BE |
| 20 | +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 21 | +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 22 | +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 23 | +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 24 | +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE |
| 25 | +USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | +*****************************************************************************/ |
| 27 | + |
| 28 | +#include "common.h" |
| 29 | + |
| 30 | +#if defined(__VEC__) || defined(__ALTIVEC__) |
| 31 | +#include "copy_microk_power10.c" |
| 32 | +#endif |
| 33 | + |
| 34 | +#ifndef HAVE_KERNEL |
| 35 | + |
| 36 | +static void copy_kernel (BLASLONG n, FLOAT *x, FLOAT *y) |
| 37 | +{ |
| 38 | + |
| 39 | + BLASLONG i=0; |
| 40 | + FLOAT f0, f1, f2, f3, f4, f5, f6, f7; |
| 41 | + FLOAT *x1=x; |
| 42 | + FLOAT *y1=y; |
| 43 | + |
| 44 | + while ( i<n ) |
| 45 | + { |
| 46 | + |
| 47 | + f0 = x1[0]; |
| 48 | + f1 = x1[1]; |
| 49 | + f2 = x1[2]; |
| 50 | + f3 = x1[3]; |
| 51 | + f4 = x1[4]; |
| 52 | + f5 = x1[5]; |
| 53 | + f6 = x1[6]; |
| 54 | + f7 = x1[7]; |
| 55 | + |
| 56 | + y1[0] = f0; |
| 57 | + y1[1] = f1; |
| 58 | + y1[2] = f2; |
| 59 | + y1[3] = f3; |
| 60 | + y1[4] = f4; |
| 61 | + y1[5] = f5; |
| 62 | + y1[6] = f6; |
| 63 | + y1[7] = f7; |
| 64 | + |
| 65 | + x1 += 8; |
| 66 | + y1 += 8; |
| 67 | + |
| 68 | + i+=8; |
| 69 | + } |
| 70 | + return; |
| 71 | + |
| 72 | +} |
| 73 | + |
| 74 | + |
| 75 | +#endif |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | +int CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG inc_y) |
| 80 | +{ |
| 81 | + BLASLONG i=0; |
| 82 | + BLASLONG ix=0,iy=0; |
| 83 | + |
| 84 | + if ( n <= 0 ) return(0); |
| 85 | + |
| 86 | + if ( (inc_x == 1) && (inc_y == 1 )) |
| 87 | + { |
| 88 | + |
| 89 | + BLASLONG n1 = n & -128; |
| 90 | + if ( n1 > 0 ) |
| 91 | + { |
| 92 | + copy_kernel (n1, x, y); |
| 93 | + i=n1; |
| 94 | + } |
| 95 | + |
| 96 | + while(i < n) |
| 97 | + { |
| 98 | + y[i] = x[i] ; |
| 99 | + i++ ; |
| 100 | + |
| 101 | + } |
| 102 | + |
| 103 | + |
| 104 | + } |
| 105 | + else |
| 106 | + { |
| 107 | + |
| 108 | + while(i < n) |
| 109 | + { |
| 110 | + y[iy] = x[ix] ; |
| 111 | + ix += inc_x ; |
| 112 | + iy += inc_y ; |
| 113 | + i++ ; |
| 114 | + |
| 115 | + } |
| 116 | + |
| 117 | + } |
| 118 | + return(0); |
| 119 | + |
| 120 | + |
| 121 | +} |
| 122 | + |
| 123 | + |
0 commit comments