1 /*******************************************************************************
2 Copyright (c) 2016, The OpenBLAS Project
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions are
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
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 *******************************************************************************/
29 #include "macros_msa.h"
31 int CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG inc_y)
34 v4f32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
35 FLOAT f0, f1, f2, f3, f4, f5, f6, f7;
37 if (n < 0) return (0);
39 if ((1 == inc_x) && (1 == inc_y))
46 pref_offset = (BLASLONG)x & (L1_DATA_LINESIZE - 1);
49 pref_offset = L1_DATA_LINESIZE - pref_offset;
50 pref_offset = pref_offset / sizeof(FLOAT);
52 x_pref = x + pref_offset + 128 + 32;
54 LD_SP8_INC(x, 4, x0, x1, x2, x3, x4, x5, x6, x7);
55 for (i = (n >> 6) - 1; i--;)
57 PREF_OFFSET(x_pref, 0);
58 PREF_OFFSET(x_pref, 32);
59 PREF_OFFSET(x_pref, 64);
60 PREF_OFFSET(x_pref, 96);
61 PREF_OFFSET(x_pref, 128);
62 PREF_OFFSET(x_pref, 160);
63 PREF_OFFSET(x_pref, 192);
64 PREF_OFFSET(x_pref, 224);
67 x8 = LD_SP(x); x += 4;
69 x9 = LD_SP(x); x += 4;
71 x10 = LD_SP(x); x += 4;
73 x11 = LD_SP(x); x += 4;
75 x12 = LD_SP(x); x += 4;
77 x13 = LD_SP(x); x += 4;
79 x14 = LD_SP(x); x += 4;
81 x15 = LD_SP(x); x += 4;
83 x0 = LD_SP(x); x += 4;
85 x1 = LD_SP(x); x += 4;
87 x2 = LD_SP(x); x += 4;
88 ST_SP(x10, y); y += 4;
89 x3 = LD_SP(x); x += 4;
90 ST_SP(x11, y); y += 4;
91 x4 = LD_SP(x); x += 4;
92 ST_SP(x12, y); y += 4;
93 x5 = LD_SP(x); x += 4;
94 ST_SP(x13, y); y += 4;
95 x6 = LD_SP(x); x += 4;
96 ST_SP(x14, y); y += 4;
97 x7 = LD_SP(x); x += 4;
98 ST_SP(x15, y); y += 4;
101 x8 = LD_SP(x); x += 4;
102 x9 = LD_SP(x); x += 4;
103 ST_SP(x0, y); y += 4;
104 x10 = LD_SP(x); x += 4;
105 ST_SP(x1, y); y += 4;
106 x11 = LD_SP(x); x += 4;
107 ST_SP(x2, y); y += 4;
108 x12 = LD_SP(x); x += 4;
109 ST_SP(x3, y); y += 4;
110 x13 = LD_SP(x); x += 4;
111 ST_SP(x4, y); y += 4;
112 x14 = LD_SP(x); x += 4;
113 ST_SP(x5, y); y += 4;
114 x15 = LD_SP(x); x += 4;
115 ST_SP(x6, y); y += 4;
116 ST_SP(x7, y); y += 4;
118 ST_SP8_INC(x8, x9, x10, x11, x12, x13, x14, x15, y, 4);
125 LD_SP8_INC(x, 4, x0, x1, x2, x3, x4, x5, x6, x7);
126 ST_SP8_INC(x0, x1, x2, x3, x4, x5, x6, x7, y, 4);
131 LD_SP4_INC(x, 4, x0, x1, x2, x3);
132 ST_SP4_INC(x0, x1, x2, x3, y, 4);
137 LD_SP2_INC(x, 4, x0, x1);
138 ST_SP2_INC(x0, x1, y, 4);
143 LD_GP4_INC(x, 1, f0, f1, f2, f3);
144 ST_GP4_INC(f0, f1, f2, f3, y, 1);
149 LD_GP2_INC(x, 1, f0, f1);
150 ST_GP2_INC(f0, f1, y, 1);
161 for (i = (n >> 3); i--;)
163 LD_GP8_INC(x, inc_x, f0, f1, f2, f3, f4, f5, f6, f7);
164 ST_GP8_INC(f0, f1, f2, f3, f4, f5, f6, f7, y, inc_y);
169 LD_GP4_INC(x, inc_x, f0, f1, f2, f3);
170 ST_GP4_INC(f0, f1, f2, f3, y, inc_y);
175 LD_GP2_INC(x, inc_x, f0, f1);
176 ST_GP2_INC(f0, f1, y, inc_y);