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

« back to all changes in this revision

Viewing changes to tune/blas/ger/R2CASES/ATL_zger2k_2x1_sse3.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.10.1
 
3
 *
 
4
 * Redistribution and use in source and binary forms, with or without
 
5
 * modification, are permitted provided that the following conditions
 
6
 * are 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 the
 
11
 *      documentation and/or other materials provided with the distribution.
 
12
 *   3. The name of the ATLAS group or the names of its contributers may
 
13
 *      not be used to endorse or promote products derived from this
 
14
 *      software without specific written permission.
 
15
 *
 
16
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
17
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 
18
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 
19
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ATLAS GROUP OR ITS CONTRIBUTORS
 
20
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 
21
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 
22
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 
23
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 
24
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 
25
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
26
 * POSSIBILITY OF SUCH DAMAGE.
 
27
 *
 
28
 */
 
29
#include "atlas_asm.h"
 
30
#ifndef ATL_GAS_x8664
 
31
   #error "This kernel requires x86-64 assembly!"
 
32
#endif
 
33
#ifndef ATL_SSE3
 
34
   #error "This routine requires SSE3!"
 
35
#endif
 
36
/*
 
37
 * Register usage
 
38
 */
 
39
#define M       %rdi  /* already in */
 
40
#define N       %rsi  /* already in */
 
41
#define II      %rax  /* loaded in loop */
 
42
#define pX      %rdx  /* already in */
 
43
#define pA0     %r11  /* 56(%rsp) */
 
44
#define pA1     %rbx  /* computed */
 
45
#define pY      %rcx  /* already in */
 
46
#define pZ      %r9   /* already in */
 
47
#define lda     %r10  /* 16(%rsp) */
 
48
#define pW      %r8   /* already in */
 
49
 
 
50
#define a0      %xmm0
 
51
#define x0      %xmm1
 
52
#define revx0   %xmm2
 
53
#define a1      %xmm3
 
54
#define A0      %xmm4
 
55
#define y0r     %xmm5
 
56
#define y0i     %xmm6
 
57
#define y1r     %xmm7
 
58
#define y1i     %xmm8
 
59
#define z0r     %xmm9
 
60
#define z0i     %xmm10
 
61
#define z1r     %xmm11
 
62
#define z1i     %xmm12
 
63
#define vposneg %xmm15
 
64
 
 
65
#define movapd movaps
 
66
/*
 
67
void ATL_UGER2K
 
68
          %rdi        %rsi           %rdx           %rcx
 
69
   (ATL_CINT M, ATL_CINT N, const TYPE *X, const TYPE *Y,
 
70
              %r8            %r9  8(%rsp)       16(%rsp)
 
71
    const TYPE *W, const TYPE *Z, TYPE *A, ATL_CINT lda);
 
72
*/
 
73
.text
 
74
.global ATL_asmdecor(ATL_UGER2K)
 
75
ALIGN64
 
76
ATL_asmdecor(ATL_UGER2K):
 
77
 
 
78
/*
 
79
 * construct vector that has -1.0 in low word, and 1.0 in high word
 
80
 */
 
81
   fld1               /* ST = 1.0 */
 
82
   fstl -16(%rsp)
 
83
   fchs               /* ST = -1.0 */
 
84
   fstpl  -24(%rsp)
 
85
   movapd -24(%rsp), vposneg      /* vposneg = {1.0, -1.0} */
 
86
/*
 
87
 * Save callee-saved regs
 
88
 */
 
89
   movq %rbx, -8(%rsp)
 
90
/*
 
91
 * Load & compute all integer variables
 
92
 */
 
93
   movslq 16(%rsp), lda
 
94
   shl  $4, lda         /* lda *= sizeof */
 
95
   movq 8(%rsp), pA0
 
96
   lea (pA0, lda), pA1   /* pA1 = pA0 + lda */
 
97
 
 
98
   lea -2(M,M), M              /* M = 2(M-1) */
 
99
//   add M, M                     /* M = 2*M */
 
100
   lea (pX, M, 8), pX           /* pX += 2*M */
 
101
   lea (pW, M, 8), pW           /* pW += 2*M */
 
102
   lea (pA0, M, 8), pA0         /* pA0 += 2*M */
 
103
   lea (pA0, lda), pA1          /* pA1 next column over */
 
104
   neg M                        /* M = -M */
 
105
/*
 
106
 * We assume N is a multiple of 2 for this loop
 
107
 */
 
108
   LOOPN:
 
109
      movddup (pY), y0r         /* y0r = {y0r, y0r} */
 
110
      movddup 8(pY), y0i        /* y0i = {y0i, y0i} */
 
111
      mulpd   vposneg, y0i      /* y0i = {y0i,-y0i} */
 
112
      movddup 16(pY), y1r       /* y1r = {y1r, y1r} */
 
113
      movddup 24(pY), y1i       /* y1i = {y1i, y1i} */
 
114
      mulpd   vposneg, y1i      /* y0i = {y1i,-y1i} */
 
115
         movapd (pX,M,8), x0           /* x0 = {x0i, x0r} */
 
116
      add     $32, pY
 
117
#
 
118
      movddup (pZ), z0r         /* z0r = {z0r, z0r} */
 
119
      movddup 8(pZ), z0i        /* z0i = {z0i, z0i} */
 
120
      mulpd   vposneg, z0i      /* z0i = {z0i,-z0i} */
 
121
      movddup 16(pZ), z1r       /* z1r = {z1r, z1r} */
 
122
      movddup 24(pZ), z1i       /* z1i = {z1i, z1i} */
 
123
      mulpd   vposneg, z1i      /* z0i = {z1i,-z1i} */
 
124
      add     $32, pZ
 
125
         pshufd $0x4E, x0, revx0        /* revx0 = {x0r, x0i} */
 
126
      mov M, II
 
127
 
 
128
ALIGN32
 
129
      LOOPM:
 
130
/*
 
131
 *       Reuse X to compute rank-1 update x*y for 2 columns of A
 
132
 */
 
133
         movapd x0, a0          /* a0 = {x0i, x0r} */
 
134
         mulpd  y0r, a0         /* a0 = {x0i*y0r, x0r*y0r} */
 
135
         addpd  (pA0,II,8), a0  /* a0 = {a0i+x0i*y0r, a0r+x0r*y0r} */
 
136
 
 
137
         movapd revx0, A0      /* A0 = {x0r, x0i} */
 
138
         mulpd  y0i, A0        /* A0 = {x0r*y0i, -x0i*y0i} */
 
139
         addpd  A0, a0;     /* a0 = {a0i+x0i*y0r+x0r*y0i,a0r+x0r*y0r-x0i*x0i} */
 
140
 
 
141
         movapd x0, a1          /* a1 = {x0i, x0r} */
 
142
                movapd (pW,II,8), x0    /* x0 = {w0i, w0r} */
 
143
         mulpd  y1r, a1        /* a1 = {x0i*y1r, x0r*y1r} */
 
144
         addpd  (pA1,II,8), a1 /* a1 = {A1i+x0i*y1r, A1r+x0r*y1r} */
 
145
         mulpd  y1i, revx0     /* rx0= {x0r*y1i, -x0i*y1i} */
 
146
         addpd  revx0, a1   /* a1={A1i+x0i*y1r+x0r*y1i, A1r+x0r*y1r-x0i*y1i} */
 
147
                pshufd $0x4E, x0, revx0        /* revx0 = {w0r, w0i} */
 
148
/*
 
149
 *       Reuse W to compute rank-1 update w*z for 2 columns of A to complete
 
150
 *       the rank-2 update of these two column elements
 
151
 */
 
152
 
 
153
         movapd x0, A0         /* A0 = {w0i, w0r} */
 
154
         mulpd  z0r, A0        /* A0 = {w0i*z0r, w0r*z0r} */
 
155
         addpd  A0, a0         /* a0 = {a0i+w0i*z0r, a0r+w0r*z0r} */
 
156
 
 
157
         movapd revx0, A0      /* A0 = {w0r, w0i} */
 
158
         mulpd  z0i, A0        /* A0 = {w0r*z0i, -w0i*z0i} */
 
159
         addpd  A0, a0         /* a0 = completed rank-2 update */
 
160
         movapd a0, (pA0,II,8) /* store completed rank-2 update */
 
161
 
 
162
         mulpd z1r, x0         /* x0 = {w0i*z1r, w0r*z1r} */
 
163
         addpd x0, a1          /* a1 = {a1i+w0i*z1r, a1r+w0r*z1r} */
 
164
                movapd 16(pX,II,8), x0           /* x0 = {x0i, x0r} */
 
165
 
 
166
         mulpd z1i, revx0      /* revx0={w0r*z1i, -w0i*z1i} */
 
167
         addpd revx0, a1       /* completed rank-2 update for a1 */
 
168
                pshufd $0x4E, x0, revx0        /* revx0 = {x0r, x0i} */
 
169
         movapd a1, (pA1,II,8)
 
170
 
 
171
      add       $2, II
 
172
      jnz LOOPM
 
173
/*
 
174
 *    ==================
 
175
 *    Drain X fetch pipe
 
176
 *    ==================
 
177
 */
 
178
/*
 
179
 *    Reuse X to compute rank-1 update x*y for 2 columns of A
 
180
 */
 
181
      movapd x0, a0          /* a0 = {x0i, x0r} */
 
182
      mulpd  y0r, a0         /* a0 = {x0i*y0r, x0r*y0r} */
 
183
      addpd  (pA0,II,8), a0  /* a0 = {a0i+x0i*y0r, a0r+x0r*y0r} */
 
184
 
 
185
      movapd revx0, A0      /* A0 = {x0r, x0i} */
 
186
      mulpd  y0i, A0        /* A0 = {x0r*y0i, -x0i*y0i} */
 
187
      addpd  A0, a0;     /* a0 = {a0i+x0i*y0r+x0r*y0i,a0r+x0r*y0r-x0i*x0i} */
 
188
 
 
189
      movapd x0, a1          /* a1 = {x0i, x0r} */
 
190
             movapd (pW,II,8), x0    /* x0 = {w0i, w0r} */
 
191
      mulpd  y1r, a1        /* a1 = {x0i*y1r, x0r*y1r} */
 
192
      addpd  (pA1,II,8), a1 /* a1 = {A1i+x0i*y1r, A1r+x0r*y1r} */
 
193
      mulpd  y1i, revx0     /* rx0= {x0r*y1i, -x0i*y1i} */
 
194
      addpd  revx0, a1   /* a1={A1i+x0i*y1r+x0r*y1i, A1r+x0r*y1r-x0i*y1i} */
 
195
             pshufd $0x4E, x0, revx0        /* revx0 = {w0r, w0i} */
 
196
/*
 
197
 *    Reuse W to compute rank-1 update w*z for 2 columns of A to complete
 
198
 *    the rank-2 update of these two column elements
 
199
 */
 
200
 
 
201
      movapd x0, A0         /* A0 = {w0i, w0r} */
 
202
      mulpd  z0r, A0        /* A0 = {w0i*z0r, w0r*z0r} */
 
203
      addpd  A0, a0         /* a0 = {a0i+w0i*z0r, a0r+w0r*z0r} */
 
204
 
 
205
      movapd revx0, A0      /* A0 = {w0r, w0i} */
 
206
      mulpd  z0i, A0        /* A0 = {w0r*z0i, -w0i*z0i} */
 
207
      addpd  A0, a0         /* a0 = completed rank-2 update */
 
208
      movapd a0, (pA0,II,8) /* store completed rank-2 update */
 
209
 
 
210
      mulpd z1r, x0         /* x0 = {w0i*z1r, w0r*z1r} */
 
211
      addpd x0, a1          /* a1 = {a1i+w0i*z1r, a1r+w0r*z1r} */
 
212
 
 
213
      mulpd z1i, revx0      /* revx0={w0r*z1i, -w0i*z1i} */
 
214
      addpd revx0, a1       /* completed rank-2 update for a1 */
 
215
      movapd a1, (pA1,II,8)
 
216
      lea (pA0, lda, 2), pA0
 
217
      lea (pA1, lda, 2), pA1
 
218
 
 
219
   sub $2, N
 
220
   jnz LOOPN
 
221
 
 
222
/*
 
223
 * EPILOGUE: restore registers and return
 
224
 */
 
225
   movq -8(%rsp), %rbx
 
226
#if 0
 
227
   movq %r13, -32(%rsp), %r13
 
228
   movq %r14, -40(%rsp), %r14
 
229
   movq %r15, -48(%rsp), %r15
 
230
#endif
 
231
   ret