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

« back to all changes in this revision

Viewing changes to tune/blas/gemv/CASES/ATL_gemvT_2x8_0.c

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot, Sylvestre Ledru, Sébastien Villemot
  • Date: 2013-06-11 15:58:16 UTC
  • mfrom: (1.1.4) (25 sid)
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: package-import@ubuntu.com-20130611155816-8xeeiziu1iml040c
Tags: 3.10.1-1
[ Sylvestre Ledru ]
* New upstream release (Closes: #609287)

[ Sébastien Villemot ]
* Provide architectural defaults (i.e. precomputed timings) for all
  release archs (except armel and mips for the time being, due to slow
  porterboxes). This will make the package build much faster and should
  eliminate transient build failures due to excessive variance in the
  timings.
* Move symlinks for lib{cblas,f77blas,atlas,lapack_atlas} out of the
  libblas.so.3 alternative and make them always present, so that
  software relying on these libs do not break when another alternative
  is selected for BLAS
* ATLAS now has improved ARM support with native asm constructs. This required
  the following tunes:
  + armel-is-v4t.diff: new patch, prevents FTBFS on armel; otherwise,
    ATLAS uses asm constructs too recent for the platform (armel is only v4t)
  + debian/rules: on armhf, define the ATL_ARM_HARDFP flag; otherwise the asm
    constructs use the soft-float ABI for passing floating points
  + on armhf, ensure that -mfloat-abi=softfp and -mcpu=vfpv3 flags are never
    used; this is implemented via a patch (armhf.diff) and by the use of fixed
    archdefs
* The generic package is now built without multi-threading, because otherwise
  the package fails to build on some single-processor machines (this required
  the introduction of a patch: fix-non-threaded-build.diff). As a side effect,
  the build of the custom package gracefully handles non-threaded
  builds. (Closes: #602524)
* Add libblas.a as slave in the libblas.so alternative (Closes: #701921)
* Add symlinks for lib{f77blas,atlas}.a in /usr/lib (Closes: #666203)
* Modify shlibs file of libatlas3-base, such that packages using
  libblas/liblapack depend on any BLAS/LAPACK alternative, while packages
  depending on ATLAS-specific libraries (e.g. libatlas.so) depend specifically
  on libatlas3-base.
* corei1.diff: remove patch, applied upstream
* Use my @debian.org email address
* Remove obsolete DM-Upload-Allowed flag
* Switch VCS to git
* Remove Conflicts/Replaces against pre-squeeze packages
* libatlas-base-dev now provides libblas.so, as libblas-dev
* No longer use -Wa,--noexecstack in CFLAGS, it makes the package FTBFS
* Do not use POWER3 arch for powerpcspe port (Closes: #701068)
* Bump to debhelper compat level 9
* README.Debian: mention that devscripts is needed to compile the custom
  package (Closes: #697431)
* Bump Standards-Version to 3.9.4. As a consequence, add Built-Using
  fields because the package embeds stuff from liblapack-pic

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_level1.h"
33
 
#include "atlas_level2.h"
34
 
 
35
 
static void gemvT_Nsmall(const int M, const int N, const TYPE *A, const int lda,
36
 
                         const TYPE *X, const SCALAR beta, TYPE *Y)
37
 
{
38
 
   int i;
39
 
   register TYPE x0, x1, x2, x3, x4, x5, x6, x7, y0;
40
 
   TYPE *stY = Y + M;
41
 
 
42
 
   switch(N)
43
 
   {
44
 
   case 1:
45
 
      #ifdef BETA0
46
 
         Mjoin(PATL,cpsc)(M, *X, A, lda, Y, 1);
47
 
      #elif defined(BETAX)
48
 
         Mjoin(PATL,axpby)(M, *X, A, lda, beta, Y, 1);
49
 
      #else
50
 
         Mjoin(PATL,axpy)(M, *X, A, lda, Y, 1);
51
 
      #endif
52
 
      break;
53
 
   case 2:
54
 
      x0 = *X;
55
 
      x1 = X[1];
56
 
      do
57
 
      {
58
 
         #ifdef BETA0
59
 
            *Y = x0 * *A + x1 * A[1];
60
 
         #elif defined(BETAX)
61
 
            y0 = *Y;
62
 
            *Y = y0 * beta + x0 * *A + x1 * A[1];
63
 
         #else
64
 
            *Y += x0 * *A + x1 * A[1];
65
 
         #endif
66
 
         A += lda;
67
 
      }
68
 
      while (++Y != stY);
69
 
      break;
70
 
   case 3:
71
 
      x0 = *X;
72
 
      x1 = X[1];
73
 
      x2 = X[2];
74
 
      do
75
 
      {
76
 
         #ifdef BETA0
77
 
            *Y = x0 * *A + x1 * A[1] + x2 * A[2];
78
 
         #elif defined(BETAX)
79
 
            y0 = *Y;
80
 
            *Y = y0 * beta + x0 * *A + x1 * A[1] + x2 * A[2];
81
 
         #else
82
 
            *Y += x0 * *A + x1 * A[1] + x2 * A[2];
83
 
         #endif
84
 
         A += lda;
85
 
      }
86
 
      while (++Y != stY);
87
 
      break;
88
 
   case 4:
89
 
      x0 = *X;
90
 
      x1 = X[1];
91
 
      x2 = X[2];
92
 
      x3 = X[3];
93
 
      do
94
 
      {
95
 
         #ifdef BETA0
96
 
            *Y = x0 * *A + x1 * A[1] + x2 * A[2] + x3 * A[3];
97
 
         #elif defined(BETAX)
98
 
            y0 = *Y;
99
 
            *Y = y0 * beta + x0 * *A + x1 * A[1] + x2 * A[2] + x3 * A[3];
100
 
         #else
101
 
            *Y += x0 * *A + x1 * A[1] + x2 * A[2] + x3 * A[3];
102
 
         #endif
103
 
         A += lda;
104
 
      }
105
 
      while (++Y != stY);
106
 
      break;
107
 
   case 5:
108
 
      x0 = *X;
109
 
      x1 = X[1];
110
 
      x2 = X[2];
111
 
      x3 = X[3];
112
 
      x4 = X[4];
113
 
      do
114
 
      {
115
 
         #ifdef BETA0
116
 
            *Y = x0 * *A + x1 * A[1] + x2 * A[2] + x3 * A[3]
117
 
                 + x4 * A[4];
118
 
         #elif defined(BETAX)
119
 
            y0 = *Y;
120
 
            *Y = y0 * beta + x0 * *A + x1 * A[1] + x2 * A[2] + x3 * A[3]
121
 
                 + x4 * A[4];
122
 
         #else
123
 
            *Y += x0 * *A + x1 * A[1] + x2 * A[2] + x3 * A[3] + x4 * A[4];
124
 
         #endif
125
 
         A += lda;
126
 
      }
127
 
      while (++Y != stY);
128
 
      break;
129
 
   case 6:
130
 
      x0 = *X;
131
 
      x1 = X[1];
132
 
      x2 = X[2];
133
 
      x3 = X[3];
134
 
      x4 = X[4];
135
 
      x5 = X[5];
136
 
      do
137
 
      {
138
 
         #ifdef BETA0
139
 
            *Y = x0 * *A + x1 * A[1] + x2 * A[2] + x3 * A[3]
140
 
                 + x4 * A[4] + x5 * A[5];
141
 
         #elif defined(BETAX)
142
 
            y0 = *Y;
143
 
            *Y = y0 * beta + x0 * *A + x1 * A[1] + x2 * A[2] + x3 * A[3]
144
 
                 + x4 * A[4] + x5 * A[5];
145
 
         #else
146
 
            *Y += x0 * *A + x1 * A[1] + x2 * A[2] + x3 * A[3]
147
 
                 + x4 * A[4] + x5 * A[5];
148
 
         #endif
149
 
         A += lda;
150
 
      }
151
 
      while (++Y != stY);
152
 
      break;
153
 
   case 7:
154
 
      x0 = *X;
155
 
      x1 = X[1];
156
 
      x2 = X[2];
157
 
      x3 = X[3];
158
 
      x4 = X[4];
159
 
      x5 = X[5];
160
 
      x6 = X[6];
161
 
      do
162
 
      {
163
 
         #ifdef BETA0
164
 
            *Y = x0 * *A + x1 * A[1] + x2 * A[2] + x3 * A[3]
165
 
                 + x4 * A[4] + x5 * A[5] + x6 * A[6];
166
 
         #elif defined(BETAX)
167
 
            y0 = *Y;
168
 
            *Y = y0 * beta + x0 * *A + x1 * A[1] + x2 * A[2] + x3 * A[3]
169
 
                 + x4 * A[4] + x5 * A[5] + x6 * A[6];
170
 
         #else
171
 
            *Y += x0 * *A + x1 * A[1] + x2 * A[2] + x3 * A[3]
172
 
                 + x4 * A[4] + x5 * A[5] + x6 * A[6];
173
 
         #endif
174
 
         A += lda;
175
 
      }
176
 
      while (++Y != stY);
177
 
      break;
178
 
   case 8:
179
 
      x0 = *X;
180
 
      x1 = X[1];
181
 
      x2 = X[2];
182
 
      x3 = X[3];
183
 
      x4 = X[4];
184
 
      x5 = X[5];
185
 
      x6 = X[6];
186
 
      x7 = X[7];
187
 
      do
188
 
      {
189
 
         #ifdef BETA0
190
 
            *Y = x0 * *A + x1 * A[1] + x2 * A[2] + x3 * A[3]
191
 
                 + x4 * A[4] + x5 * A[5] + x6 * A[6] + x7 * A[7];
192
 
         #elif defined(BETAX)
193
 
            y0 = *Y;
194
 
            *Y = y0 * beta + x0 * *A + x1 * A[1] + x2 * A[2] + x3 * A[3]
195
 
                 + x4 * A[4] + x5 * A[5] + x6 * A[6] + x7 * A[7];
196
 
         #else
197
 
            *Y += x0 * *A + x1 * A[1] + x2 * A[2] + x3 * A[3]
198
 
                 + x4 * A[4] + x5 * A[5] + x6 * A[6] + x7 * A[7];
199
 
         #endif
200
 
         A += lda;
201
 
      }
202
 
      while (++Y != stY);
203
 
      break;
204
 
   default:
205
 
      if (M)
206
 
      {
207
 
         do
208
 
         {
209
 
            #ifdef BETA0
210
 
               y0 = ATL_rzero;
211
 
            #elif defined(BETAX)
212
 
               y0 = *Y * beta;
213
 
            #else
214
 
               y0 = *Y;
215
 
            #endif
216
 
            for (i=0; i != N; i++) y0 += A[i] * X[i];
217
 
            *Y++ = y0;
218
 
            A += lda;
219
 
         }
220
 
         while (Y != stY);
221
 
      }
222
 
   }
223
 
}
224
 
 
225
 
static void gemvT_Msmall(const int M, const int N, const TYPE *A, const int lda,
226
 
                         const TYPE *X, const SCALAR beta, TYPE *Y)
227
 
{
228
 
   const TYPE *stY = Y + M;
229
 
   #ifndef BETA0
230
 
      register TYPE y0;
231
 
   #endif
232
 
 
233
 
   do
234
 
   {
235
 
      #ifdef BETA0
236
 
         *Y = Mjoin(PATL,dot)(N, X, 1, A, 1);
237
 
      #else
238
 
         y0 = *Y;
239
 
         #ifdef BETAX
240
 
            y0 *= beta;
241
 
         #endif
242
 
         y0 += Mjoin(PATL,dot)(N, X, 1, A, 1);
243
 
         *Y = y0;
244
 
      #endif
245
 
      Y++;
246
 
      A += lda;
247
 
   }
248
 
   while (Y != stY);
249
 
}
250
 
#define gemv0 Mjoin(Mjoin(Mjoin(Mjoin(gemvT,NM),_x1),BNM),_y1)
251
 
void Mjoin(PATL,gemv0)
252
 
   (const int M, const int N, const SCALAR alpha,
253
 
    const TYPE *A, const int lda, const TYPE *X, const int incX,
254
 
    const SCALAR beta, TYPE *Y, const int incY)
255
 
{
256
 
 
257
 
   const int M2 = (M>>1)<<1, n4 = (N>>2)<<2;
258
 
   const int nr = N-n4, incAm = (lda<<1) - n4;
259
 
   const TYPE *stX = X + n4 - 4, *x, *A0 = A, *A1 = A + lda;
260
 
   TYPE *stY = Y + M2;
261
 
   register TYPE y0, y1, yy0, yy1, x0, x1, x2, x3, m0, m1, m2, m3;
262
 
   register TYPE a00, a10, a20, a30, a01, a11, a21, a31;
263
 
 
264
 
   if (N >= 8)
265
 
   {
266
 
      if (M2)
267
 
      {
268
 
         do
269
 
         {
270
 
            x = X + 4;
271
 
            #ifdef BETA0
272
 
               y0 = y1 = yy0 = yy1 = ATL_rzero;
273
 
            #elif defined(BETAX)
274
 
               y0 = beta;
275
 
               yy0 = *Y * y0; yy1 = Y[1] * y0;
276
 
               y0 = y1 = ATL_rzero;
277
 
            #else
278
 
               yy0 = *Y; yy1 = Y[1];
279
 
               y0 = y1 = ATL_rzero;
280
 
            #endif
281
 
            a00 = *A0; a10 = A0[1]; a20 = A0[2]; a30 = A0[3]; A0 += 4;
282
 
            a01 = *A1; a11 = A1[1]; a21 = A1[2]; a31 = A1[3]; A1 += 4;
283
 
            x0 = *X; x1 = X[1]; x2 = X[2]; x3 = X[3];
284
 
            m0 = a00 * x0; a00 = *A0;
285
 
            m1 = a01 * x0; a01 = *A1; x0 = *x;
286
 
            m2 = a10 * x1; a10 = A0[1];
287
 
            m3 = a11 * x1; a11 = A1[1]; x1 = x[1];
288
 
 
289
 
            if (n4 != 8)
290
 
            {
291
 
               do
292
 
               {
293
 
                  y0  += m0; m0 = a20 * x2; a20 = A0[2];
294
 
                  y1  += m1; m1 = a21 * x2; a21 = A1[2]; x2 = x[2];
295
 
                  yy0 += m2; m2 = a30 * x3; a30 = A0[3]; A0 += 4;
296
 
                  yy1 += m3; m3 = a31 * x3; a31 = A1[3]; A1 += 4;
297
 
                             x3 = x[3]; x += 4;
298
 
                  y0  += m0; m0 = a00 * x0; a00 = *A0;
299
 
                  y1  += m1; m1 = a01 * x0; a01 = *A1;   x0 = *x;
300
 
                  yy0 += m2; m2 = a10 * x1; a10 = A0[1];
301
 
                  yy1 += m3; m3 = a11 * x1; a11 = A1[1]; x1 = x[1];
302
 
               }
303
 
               while (x != stX);
304
 
            }
305
 
/*
306
 
 *          Drain pipes, then do cleanup
307
 
 */
308
 
            y0  += m0; m0 = a20 * x2; a20 = A0[2];
309
 
            y1  += m1; m1 = a21 * x2; a21 = A1[2]; x2 = x[2];
310
 
            yy0 += m2; m2 = a30 * x3; a30 = A0[3]; A0 += 4;
311
 
            yy1 += m3; m3 = a31 * x3; a31 = A1[3]; A1 += 4; x3 = x[3]; x += 4;
312
 
            y0  += m0; m0 = a00 * x0;
313
 
            y1  += m1; m1 = a01 * x0;
314
 
            yy0 += m2; m2 = a10 * x1;
315
 
            yy1 += m3; m3 = a11 * x1;
316
 
 
317
 
            y0  += m0; m0 = a20 * x2;
318
 
            y1  += m1; m1 = a21 * x2;
319
 
            yy0 += m2; m2 = a30 * x3;
320
 
            yy1 += m3; m3 = a31 * x3;
321
 
            y0  += m0;
322
 
            y1  += m1;
323
 
            yy0 += m2;
324
 
            yy1 += m3;
325
 
 
326
 
            switch(nr)
327
 
            {
328
 
            case 1:
329
 
               x0 = *x;
330
 
               y0 += *A0 * x0;
331
 
               y1 += *A1 * x0;
332
 
               break;
333
 
            case 2:
334
 
               x0 = *x;
335
 
               x1 = x[1];
336
 
               y0  += *A0 * x0;
337
 
               y1  += *A1 * x0;
338
 
               yy0 += A0[1] * x1;
339
 
               yy1 += A1[1] * x1;
340
 
               break;
341
 
            case 3:
342
 
               x0 = *x;
343
 
               x1 = x[1];
344
 
               x2 = x[2];
345
 
               y0  += *A0 * x0;
346
 
               y1  += *A1 * x0;
347
 
               yy0 += A0[1] * x1;
348
 
               yy1 += A1[1] * x1;
349
 
               y0  += A0[2] * x2;
350
 
               y1  += A1[2] * x2;
351
 
               break;
352
 
            default:;
353
 
            }
354
 
            A0 += incAm;
355
 
            y0 += yy0;
356
 
            A1 += incAm;
357
 
            y1 += yy1;
358
 
            *Y = y0;
359
 
            Y[1] = y1;
360
 
            Y += 2;
361
 
         }
362
 
         while (Y != stY);
363
 
      }
364
 
      if (M-M2)
365
 
      {
366
 
         #ifdef BETA0
367
 
            *Y = Mjoin(PATL,dot)(N, X, 1, A0, 1);
368
 
         #else
369
 
            y0 = *Y;
370
 
            #ifdef BETAX
371
 
               y0 *= beta;
372
 
            #endif
373
 
            y0 += Mjoin(PATL,dot)(N, X, 1, A0, 1);
374
 
            *Y = y0;
375
 
         #endif
376
 
      }
377
 
   }
378
 
   else if (M) gemvT_Nsmall(M, N, A, lda, X, beta, Y);
379
 
 
380
 
}