~ubuntu-branches/ubuntu/vivid/atlas/vivid

« back to all changes in this revision

Viewing changes to tune/blas/ger/CASES/ATL_ger1_8x4_0.c

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot
  • Date: 2013-06-11 15:58:16 UTC
  • mfrom: (1.1.3 upstream)
  • mto: (2.2.21 experimental)
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: package-import@ubuntu.com-20130611155816-b72z8f621tuhbzn0
Tags: upstream-3.10.1
Import upstream version 3.10.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *             Automatically Tuned Linear Algebra Software v3.8.4
3
 
 *                    (C) Copyright 1999 R. Clint Whaley
4
 
 *
5
 
 * Redistribution and use in source and binary forms, with or without
6
 
 * modification, are permitted provided that the following conditions
7
 
 * are met:
8
 
 *   1. Redistributions of source code must retain the above copyright
9
 
 *      notice, this list of conditions and the following disclaimer.
10
 
 *   2. Redistributions in binary form must reproduce the above copyright
11
 
 *      notice, this list of conditions, and the following disclaimer in the
12
 
 *      documentation and/or other materials provided with the distribution.
13
 
 *   3. The name of the ATLAS group or the names of its contributers may
14
 
 *      not be used to endorse or promote products derived from this
15
 
 *      software without specific written permission.
16
 
 *
17
 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
 
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19
 
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20
 
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ATLAS GROUP OR ITS CONTRIBUTORS
21
 
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
 
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
 
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
 
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
 
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
 
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
 
 * POSSIBILITY OF SUCH DAMAGE.
28
 
 *
29
 
 */
30
 
 
31
 
#include "atlas_misc.h"
32
 
#include "atlas_lvl2.h"
33
 
 
34
 
static void ger_Mle8(const int M, const int N, const TYPE *X,
35
 
                     const TYPE *Y, const int incY, TYPE *A, const int lda)
36
 
{
37
 
   const TYPE *stY = Y + incY*N;
38
 
   register TYPE y0, x0, x1, x2, x3, x4, x5, x6, x7;
39
 
 
40
 
   switch(M)
41
 
   {
42
 
   case 1:
43
 
      x0 = *X;
44
 
      do
45
 
      {
46
 
         *A += *Y * x0;
47
 
         A += lda;
48
 
         Y += incY;
49
 
      }
50
 
      while (Y != stY);
51
 
      break;
52
 
   case 2:
53
 
      x0 = *X;
54
 
      x1 = X[1];
55
 
      do
56
 
      {
57
 
         y0 = *Y;
58
 
         *A += y0 * x0; Y += incY;
59
 
         A[1] += y0 * x1;
60
 
         A += lda;
61
 
      }
62
 
      while (Y != stY);
63
 
      break;
64
 
   case 3:
65
 
      x0 = *X;
66
 
      x1 = X[1];
67
 
      x2 = X[2];
68
 
      do
69
 
      {
70
 
         y0 = *Y;
71
 
         *A += y0 * x0;
72
 
         A[1] += y0 * x1; Y += incY;
73
 
         A[2] += y0 * x2; A += lda;
74
 
      }
75
 
      while (Y != stY);
76
 
      break;
77
 
   case 4:
78
 
      x0 = *X;
79
 
      x1 = X[1];
80
 
      x2 = X[2];
81
 
      x3 = X[3];
82
 
      do
83
 
      {
84
 
         y0 = *Y;
85
 
         *A += y0 * x0;
86
 
         A[1] += y0 * x1; Y += incY;
87
 
         A[2] += y0 * x2;
88
 
         A[3] += y0 * x3; A += lda;
89
 
      }
90
 
      while (Y != stY);
91
 
      break;
92
 
   case 5:
93
 
      x0 = *X;
94
 
      x1 = X[1];
95
 
      x2 = X[2];
96
 
      x3 = X[3];
97
 
      x4 = X[4];
98
 
      do
99
 
      {
100
 
         y0 = *Y;
101
 
         *A += y0 * x0;
102
 
         A[1] += y0 * x1; Y += incY;
103
 
         A[2] += y0 * x2;
104
 
         A[3] += y0 * x3;
105
 
         A[4] += y0 * x4; A += lda;
106
 
      }
107
 
      while (Y != stY);
108
 
      break;
109
 
   case 6:
110
 
      x0 = *X;
111
 
      x1 = X[1];
112
 
      x2 = X[2];
113
 
      x3 = X[3];
114
 
      x4 = X[4];
115
 
      x5 = X[5];
116
 
      do
117
 
      {
118
 
         y0 = *Y;
119
 
         *A += y0 * x0;
120
 
         A[1] += y0 * x1; Y += incY;
121
 
         A[2] += y0 * x2;
122
 
         A[3] += y0 * x3;
123
 
         A[4] += y0 * x4;
124
 
         A[5] += y0 * x5; A += lda;
125
 
      }
126
 
      while (Y != stY);
127
 
      break;
128
 
   case 7:
129
 
      x0 = *X;
130
 
      x1 = X[1];
131
 
      x2 = X[2];
132
 
      x3 = X[3];
133
 
      x4 = X[4];
134
 
      x5 = X[5];
135
 
      x6 = X[6];
136
 
      do
137
 
      {
138
 
         y0 = *Y;
139
 
         *A += y0 * x0;
140
 
         A[1] += y0 * x1;
141
 
         A[2] += y0 * x2; Y += incY;
142
 
         A[3] += y0 * x3;
143
 
         A[4] += y0 * x4;
144
 
         A[5] += y0 * x5;
145
 
         A[6] += y0 * x6; A += lda;
146
 
      }
147
 
      while (Y != stY);
148
 
      break;
149
 
   case 8:
150
 
      x0 = *X;
151
 
      x1 = X[1];
152
 
      x2 = X[2];
153
 
      x3 = X[3];
154
 
      x4 = X[4];
155
 
      x5 = X[5];
156
 
      x6 = X[6];
157
 
      x7 = X[7];
158
 
      do
159
 
      {
160
 
         y0 = *Y;
161
 
         *A += y0 * x0;
162
 
         A[1] += y0 * x1;
163
 
         A[2] += y0 * x2; Y += incY;
164
 
         A[3] += y0 * x3;
165
 
         A[4] += y0 * x4;
166
 
         A[5] += y0 * x5;
167
 
         A[6] += y0 * x6;
168
 
         A[7] += y0 * x7; A += lda;
169
 
      }
170
 
      while (Y != stY);
171
 
      break;
172
 
   default:
173
 
      ATL_assert(M == 0);
174
 
   }
175
 
}
176
 
static void ger_Nle4(const int M, const int N, const TYPE *X,
177
 
                     const TYPE *Y, const int incY, TYPE *A, const int lda)
178
 
{
179
 
   register TYPE y0, y1, y2, y3, x0;
180
 
   TYPE *A0 = A, *A1 = A+lda, *A2 = A1+lda, *A3 = A2+lda;
181
 
   int i;
182
 
 
183
 
   switch(N)
184
 
   {
185
 
   case 1:
186
 
      y0 = *Y;
187
 
      for (i=0; i != M; i++) A0[i] += y0 * X[i];
188
 
      break;
189
 
   case 2:
190
 
      y0 = *Y; y1 = Y[incY];
191
 
      for (i=0; i != M; i++)
192
 
      {
193
 
         x0 = X[i];
194
 
         A0[i] += y0 * x0;
195
 
         A1[i] += y1 * x0;
196
 
      }
197
 
      break;
198
 
   case 3:
199
 
      y0 = *Y; y1 = Y[incY]; y2 = Y[incY<<1];
200
 
      for (i=0; i != M; i++)
201
 
      {
202
 
         x0 = X[i];
203
 
         A0[i] += y0 * x0;
204
 
         A1[i] += y1 * x0;
205
 
         A2[i] += y2 * x0;
206
 
      }
207
 
      break;
208
 
   case 4:
209
 
      y0 = *Y; y1 = Y[incY]; y2 = Y[incY+incY]; y3 = Y[(incY<<1)+incY];
210
 
      for (i=0; i != M; i++)
211
 
      {
212
 
         x0 = X[i];
213
 
         A0[i] += y0 * x0;
214
 
         A1[i] += y1 * x0;
215
 
         A2[i] += y2 * x0;
216
 
         A3[i] += y3 * x0;
217
 
      }
218
 
      break;
219
 
   default:;
220
 
   }
221
 
}
222
 
void Mjoin(PATL,ger1_a1_x1_yX)
223
 
   (const int M, const int N, const SCALAR alpha, const TYPE *X, const int incX,
224
 
    const TYPE *Y, const int incY, TYPE *A, const int lda)
225
 
{
226
 
   int i, j;
227
 
   const int incy = incY<<2;
228
 
   const TYPE *Y1= Y + incY, *Y2 = Y1 + incY, *Y3 = Y2 + incY;
229
 
   const TYPE *x;
230
 
   TYPE *A0 = A, *A1 = A + lda, *A2 = A1 + lda, *A3 = A2 + lda;
231
 
   const int M8 = ((M-1)>>3)<<3, mr = M-M8-1;
232
 
   const int N4 = (N>>2)<<2, incAn = (lda<<2) - M + 1;
233
 
   register TYPE m0, m1, m2, m3, x0, y0, y1, y2, y3;
234
 
 
235
 
   if (M8)
236
 
   {
237
 
      for (j=N4; j; j -= 4)
238
 
      {
239
 
         y0 = *Y; y1 = *Y1; y2 = *Y2; y3 = *Y3;
240
 
         x0 = *X; x = X + 1;
241
 
         m0 = y0 * x0; Y += incy;
242
 
         m1 = y1 * x0; Y1 += incy;
243
 
         m2 = y2 * x0; Y2 += incy;
244
 
         m3 = y3 * x0; Y3 += incy;
245
 
         for (i=M8; i; i -= 8)
246
 
         {
247
 
            x0 = *x;
248
 
            *A0 += m0; m0 = y0 * x0;
249
 
            *A1 += m1; m1 = y1 * x0;
250
 
            *A2 += m2; m2 = y2 * x0;
251
 
            *A3 += m3; m3 = y3 * x0;
252
 
            x0 = x[1];
253
 
            A0[1] += m0; m0 = y0 * x0;
254
 
            A1[1] += m1; m1 = y1 * x0;
255
 
            A2[1] += m2; m2 = y2 * x0;
256
 
            A3[1] += m3; m3 = y3 * x0;
257
 
            x0 = x[2];
258
 
            A0[2] += m0; m0 = y0 * x0;
259
 
            A1[2] += m1; m1 = y1 * x0;
260
 
            A2[2] += m2; m2 = y2 * x0;
261
 
            A3[2] += m3; m3 = y3 * x0;
262
 
            x0 = x[3];
263
 
            A0[3] += m0; m0 = y0 * x0;
264
 
            A1[3] += m1; m1 = y1 * x0;
265
 
            A2[3] += m2; m2 = y2 * x0;
266
 
            A3[3] += m3; m3 = y3 * x0;
267
 
            x0 = x[4];
268
 
            A0[4] += m0; m0 = y0 * x0;
269
 
            A1[4] += m1; m1 = y1 * x0;
270
 
            A2[4] += m2; m2 = y2 * x0;
271
 
            A3[4] += m3; m3 = y3 * x0;
272
 
            x0 = x[5];
273
 
            A0[5] += m0; m0 = y0 * x0;
274
 
            A1[5] += m1; m1 = y1 * x0;
275
 
            A2[5] += m2; m2 = y2 * x0;
276
 
            A3[5] += m3; m3 = y3 * x0;
277
 
            x0 = x[6];
278
 
            A0[6] += m0; m0 = y0 * x0;
279
 
            A1[6] += m1; m1 = y1 * x0;
280
 
            A2[6] += m2; m2 = y2 * x0;
281
 
            A3[6] += m3; m3 = y3 * x0;
282
 
            x0 = x[7]; x += 8;
283
 
            A0[7] += m0; m0 = y0 * x0; A0 += 8;
284
 
            A1[7] += m1; m1 = y1 * x0; A1 += 8;
285
 
            A2[7] += m2; m2 = y2 * x0; A2 += 8;
286
 
            A3[7] += m3; m3 = y3 * x0; A3 += 8;
287
 
         }
288
 
         if (mr)
289
 
         {
290
 
            for (i=mr; i; i--)
291
 
            {
292
 
               x0 = *x++;
293
 
               *A0++ += m0; m0 = y0 * x0;
294
 
               *A1++ += m1; m1 = y1 * x0;
295
 
               *A2++ += m2; m2 = y2 * x0;
296
 
               *A3++ += m3; m3 = y3 * x0;
297
 
            }
298
 
         }
299
 
         *A0 += m0; A0 += incAn;
300
 
         *A1 += m1; A1 += incAn;
301
 
         *A2 += m2; A2 += incAn;
302
 
         *A3 += m3; A3 += incAn;
303
 
      }
304
 
      if (N-N4) ger_Nle4(M, N-N4, X, Y, incY, A0, lda);
305
 
   }
306
 
   else ger_Mle8(M, N, X, Y, incY, A, lda);
307
 
}