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

« back to all changes in this revision

Viewing changes to tune/blas/ger/CASES/ATL_ger1_axpy.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
 
#include "atlas_prefetch.h"
34
 
 
35
 
static void ger_Mle8(const int M, const int N, const TYPE *X,
36
 
                     const TYPE *Y, const int incY, TYPE *A, const int lda)
37
 
{
38
 
   const TYPE *stY = Y + incY*N;
39
 
   register TYPE y0, x0, x1, x2, x3, x4, x5, x6, x7;
40
 
 
41
 
   switch(M)
42
 
   {
43
 
   case 1:
44
 
      x0 = *X;
45
 
      do
46
 
      {
47
 
         *A += *Y * x0;
48
 
         A += lda;
49
 
         Y += incY;
50
 
      }
51
 
      while (Y != stY);
52
 
      break;
53
 
   case 2:
54
 
      x0 = *X;
55
 
      x1 = X[1];
56
 
      do
57
 
      {
58
 
         y0 = *Y;
59
 
         *A += y0 * x0; Y += incY;
60
 
         A[1] += y0 * x1;
61
 
         A += lda;
62
 
      }
63
 
      while (Y != stY);
64
 
      break;
65
 
   case 3:
66
 
      x0 = *X;
67
 
      x1 = X[1];
68
 
      x2 = X[2];
69
 
      do
70
 
      {
71
 
         y0 = *Y;
72
 
         *A += y0 * x0;
73
 
         A[1] += y0 * x1; Y += incY;
74
 
         A[2] += y0 * x2; A += lda;
75
 
      }
76
 
      while (Y != stY);
77
 
      break;
78
 
   case 4:
79
 
      x0 = *X;
80
 
      x1 = X[1];
81
 
      x2 = X[2];
82
 
      x3 = X[3];
83
 
      do
84
 
      {
85
 
         y0 = *Y;
86
 
         *A += y0 * x0;
87
 
         A[1] += y0 * x1; Y += incY;
88
 
         A[2] += y0 * x2;
89
 
         A[3] += y0 * x3; A += lda;
90
 
      }
91
 
      while (Y != stY);
92
 
      break;
93
 
   case 5:
94
 
      x0 = *X;
95
 
      x1 = X[1];
96
 
      x2 = X[2];
97
 
      x3 = X[3];
98
 
      x4 = X[4];
99
 
      do
100
 
      {
101
 
         y0 = *Y;
102
 
         *A += y0 * x0;
103
 
         A[1] += y0 * x1; Y += incY;
104
 
         A[2] += y0 * x2;
105
 
         A[3] += y0 * x3;
106
 
         A[4] += y0 * x4; A += lda;
107
 
      }
108
 
      while (Y != stY);
109
 
      break;
110
 
   case 6:
111
 
      x0 = *X;
112
 
      x1 = X[1];
113
 
      x2 = X[2];
114
 
      x3 = X[3];
115
 
      x4 = X[4];
116
 
      x5 = X[5];
117
 
      do
118
 
      {
119
 
         y0 = *Y;
120
 
         *A += y0 * x0;
121
 
         A[1] += y0 * x1; Y += incY;
122
 
         A[2] += y0 * x2;
123
 
         A[3] += y0 * x3;
124
 
         A[4] += y0 * x4;
125
 
         A[5] += y0 * x5; A += lda;
126
 
      }
127
 
      while (Y != stY);
128
 
      break;
129
 
   case 7:
130
 
      x0 = *X;
131
 
      x1 = X[1];
132
 
      x2 = X[2];
133
 
      x3 = X[3];
134
 
      x4 = X[4];
135
 
      x5 = X[5];
136
 
      x6 = X[6];
137
 
      do
138
 
      {
139
 
         y0 = *Y;
140
 
         *A += y0 * x0;
141
 
         A[1] += y0 * x1;
142
 
         A[2] += y0 * x2; Y += incY;
143
 
         A[3] += y0 * x3;
144
 
         A[4] += y0 * x4;
145
 
         A[5] += y0 * x5;
146
 
         A[6] += y0 * x6; A += lda;
147
 
      }
148
 
      while (Y != stY);
149
 
      break;
150
 
   case 8:
151
 
      x0 = *X;
152
 
      x1 = X[1];
153
 
      x2 = X[2];
154
 
      x3 = X[3];
155
 
      x4 = X[4];
156
 
      x5 = X[5];
157
 
      x6 = X[6];
158
 
      x7 = X[7];
159
 
      do
160
 
      {
161
 
         y0 = *Y;
162
 
         *A += y0 * x0;
163
 
         A[1] += y0 * x1;
164
 
         A[2] += y0 * x2; Y += incY;
165
 
         A[3] += y0 * x3;
166
 
         A[4] += y0 * x4;
167
 
         A[5] += y0 * x5;
168
 
         A[6] += y0 * x6;
169
 
         A[7] += y0 * x7; A += lda;
170
 
      }
171
 
      while (Y != stY);
172
 
      break;
173
 
   default:
174
 
      ATL_assert(M == 0);
175
 
   }
176
 
}
177
 
static void ger_Nle4(const int M, const int N, const TYPE *X,
178
 
                     const TYPE *Y, const int incY, TYPE *A, const int lda)
179
 
{
180
 
   register TYPE y0, y1, y2, y3, x0;
181
 
   TYPE *A0 = A, *A1 = A+lda, *A2 = A1+lda, *A3 = A2+lda;
182
 
   int i;
183
 
 
184
 
   switch(N)
185
 
   {
186
 
   case 1:
187
 
      y0 = *Y;
188
 
      for (i=0; i != M; i++) A0[i] += y0 * X[i];
189
 
      break;
190
 
   case 2:
191
 
      y0 = *Y; y1 = Y[incY];
192
 
      for (i=0; i != M; i++)
193
 
      {
194
 
         x0 = X[i];
195
 
         A0[i] += y0 * x0;
196
 
         A1[i] += y1 * x0;
197
 
      }
198
 
      break;
199
 
   case 3:
200
 
      y0 = *Y; y1 = Y[incY]; y2 = Y[incY<<1];
201
 
      for (i=0; i != M; i++)
202
 
      {
203
 
         x0 = X[i];
204
 
         A0[i] += y0 * x0;
205
 
         A1[i] += y1 * x0;
206
 
         A2[i] += y2 * x0;
207
 
      }
208
 
      break;
209
 
   case 4:
210
 
      y0 = *Y; y1 = Y[incY]; y2 = Y[incY+incY]; y3 = Y[(incY<<1)+incY];
211
 
      for (i=0; i != M; i++)
212
 
      {
213
 
         x0 = X[i];
214
 
         A0[i] += y0 * x0;
215
 
         A1[i] += y1 * x0;
216
 
         A2[i] += y2 * x0;
217
 
         A3[i] += y3 * x0;
218
 
      }
219
 
      break;
220
 
   default:;
221
 
   }
222
 
}
223
 
void Mjoin(PATL,ger1_a1_x1_yX)
224
 
   (const int M, const int N, const SCALAR alpha, const TYPE *X, const int incX,
225
 
    const TYPE *Y, const int incY, TYPE *A, const int lda)
226
 
{
227
 
   const TYPE *stY = Y + N*incY;
228
 
   if (M > 8)
229
 
   {
230
 
      do
231
 
      {
232
 
         Mjoin(PATL,axpy)(M, *Y, X, 1, A, 1);
233
 
         Y += incY;
234
 
         A += lda;
235
 
      }
236
 
      while (Y != stY);
237
 
   }
238
 
   else ger_Mle8(M, N, X, Y, incY, A, lda);
239
 
}