summaryrefslogtreecommitdiff
path: root/kernel/ia64/caxpy.S
blob: 1a994e798a44c5bf6d37846c1b146f6d4306ca3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin.           */
/* All rights reserved.                                              */
/*                                                                   */
/* Redistribution and use in source and binary forms, with or        */
/* without modification, are permitted provided that the following   */
/* conditions are met:                                               */
/*                                                                   */
/*   1. Redistributions of source code must retain the above         */
/*      copyright notice, this list of conditions and the following  */
/*      disclaimer.                                                  */
/*                                                                   */
/*   2. Redistributions in binary form must reproduce the above      */
/*      copyright notice, this list of conditions and the following  */
/*      disclaimer in the documentation and/or other materials       */
/*      provided with the distribution.                              */
/*                                                                   */
/*    THIS  SOFTWARE IS PROVIDED  BY THE  UNIVERSITY OF  TEXAS AT    */
/*    AUSTIN  ``AS IS''  AND ANY  EXPRESS OR  IMPLIED WARRANTIES,    */
/*    INCLUDING, BUT  NOT LIMITED  TO, THE IMPLIED  WARRANTIES OF    */
/*    MERCHANTABILITY  AND FITNESS FOR  A PARTICULAR  PURPOSE ARE    */
/*    DISCLAIMED.  IN  NO EVENT SHALL THE UNIVERSITY  OF TEXAS AT    */
/*    AUSTIN OR CONTRIBUTORS BE  LIABLE FOR ANY DIRECT, INDIRECT,    */
/*    INCIDENTAL,  SPECIAL, EXEMPLARY,  OR  CONSEQUENTIAL DAMAGES    */
/*    (INCLUDING, BUT  NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE    */
/*    GOODS  OR  SERVICES; LOSS  OF  USE,  DATA,  OR PROFITS;  OR    */
/*    BUSINESS INTERRUPTION) HOWEVER CAUSED  AND ON ANY THEORY OF    */
/*    LIABILITY, WHETHER  IN CONTRACT, STRICT  LIABILITY, OR TORT    */
/*    (INCLUDING NEGLIGENCE OR OTHERWISE)  ARISING IN ANY WAY OUT    */
/*    OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF ADVISED  OF  THE    */
/*    POSSIBILITY OF SUCH DAMAGE.                                    */
/*                                                                   */
/* The views and conclusions contained in the software and           */
/* documentation are those of the authors and should not be          */
/* interpreted as representing official policies, either expressed   */
/* or implied, of The University of Texas at Austin.                 */
/*********************************************************************/

#define ASSEMBLER
#include "common.h"

#define PREFETCH_SIZE (32 * 16)

#ifndef CONJ
#define FMA1	FNMA
#define FMA2	FMA
#else
#define FMA1	FMA
#define FMA2	FNMA
#endif

#define SP	r12

#define N	r32
#define X1	r37
#define INCX	r38
#define Y1	r39
#define INCY	r36

#define PREX1	r2
#define PREY1	r3

#define I	r33
#define J	r34
#define Y2	r35
#define X2	r14
#define YY1	r15
#define YY2	r16
#define YY3	r17
#define YY4	r18

#define INCXM1  r19
#define INCYM1  r20
#define INCX3M1 r21
#define INCY3M1 r22
#define INCX7M1 r23
#define INCY7M1 r24

#define X3	r8
#define Y3	r9
#define X4	r10
#define Y4	r11
#define INCX8	r25
#define INCY8	r26

#define ARLC	r29
#define PR	r30

#define ALPHA_R	f8
#define ALPHA_I	f9

	PROLOGUE
	.prologue
	PROFCODE

	{ .mmi
	adds	r14 = 16, SP
	and	J =  7, N
	.save ar.lc, ARLC
	mov	ARLC = ar.lc
	}
	{ .mib
	cmp.gt	p15, p0 = r0, N
	shr	I =  N, 3
	(p15) br.ret.sptk.many b0
	}
	;;
	{ .mmi
	ld8	INCY   = [r14]
	nop	__LINE__
	mov	PR = pr
	}
	{ .mmi
	adds	PREX1 = (PREFETCH_SIZE + 0) * SIZE, X1
	adds	PREY1 = (PREFETCH_SIZE + 0) * SIZE, Y1
	shl	INCX = INCX, ZBASE_SHIFT
	}
	;;
	{ .mii
	adds	I = -1, I
	mov	pr.rot= 0
	shl	INCY = INCY, ZBASE_SHIFT
	}
	;;
	{ .mmi
	adds	INCXM1  = -SIZE, INCX
	adds	INCYM1  = -SIZE, INCY
	mov	ar.ec = 3
	}
	{ .mmi
	shladd	X2  = INCX, 1, X1
	shladd	Y2  = INCY, 1, Y1
	cmp.eq	p16, p0 = r0, r0
	}
	;;
	{ .mmi
	shladd	INCX3M1 = INCX, 1, INCXM1
	shladd	INCY3M1 = INCY, 1, INCYM1
	shladd	INCX8 = INCX, 3, r0
	}
	{ .mmi
	shladd	X3  = INCX, 1, X2
	shladd	Y3  = INCY, 1, Y2
	shladd	INCY8 = INCY, 3, r0
	}
	;;
	{ .mmi
	shladd	X4  = INCX, 1, X3
	shladd	Y4  = INCY, 1, Y3
	shladd	INCX7M1 = INCX, 2, INCX3M1
	}
	{ .mmi
	mov	YY1 = Y1
	mov	YY2 = Y2
	shladd	INCY7M1 = INCY, 2, INCY3M1
	}
	;;
	{ .mmi
	mov	YY3 = Y3
	mov	YY4 = Y4
	mov	ar.lc = I
	}
	{ .mib
	cmp.eq	p11 ,p0 = -1, I
	tbit.z	p0, p13 = N, 2
	(p11) br.cond.dpnt  .L25
	}
	;;
	.align 32

.L22:
	{ .mmf
	(p19) STFD	[YY3] = f14
	(p19) STFD	[YY4] = f15
	(p18) FMA2	f14 = ALPHA_R, f64, f112
	}
	{ .mmf
	(p16) LDFD	f80  = [Y1], 1 * SIZE
	(p16) LDFD	f92  = [Y2], 1 * SIZE
	(p18) FMA2	f15 = ALPHA_R, f76, f124
	}
	;;
	{ .mmf
	(p16) lfetch.excl.nt1 [PREY1], INCY8
	(p16) LDFD	f104 = [Y3], 1 * SIZE
	(p18) FMA1	f6  = ALPHA_I, f40, f6
	}
	{ .mmf
	(p16) LDFD	f116 = [Y4], 1 * SIZE
	nop	__LINE__
	(p18) FMA1	f7  = ALPHA_I, f52, f7
	}
	;;
	{ .mmf
	(p16) LDFD	f86  = [Y1], INCYM1
	(p16) LDFD	f98  = [Y2], INCYM1
	(p18) FMA1	f10 = ALPHA_I, f64, f10
	}
	{ .mmf
	nop	__LINE__
	nop	__LINE__
	(p18) FMA1	f11 = ALPHA_I, f76, f11
	}
	;;
	{ .mmf
	(p16) LDFD	f110 = [Y3], INCYM1
	(p16) LDFD	f122 = [Y4], INCYM1
	(p18) FMA	f12 = ALPHA_I, f34, f12
	}
	{ .mmf
	(p19) add	YY1 = YY1, INCY7M1
	(p19) add	YY2 = YY2, INCY7M1
	(p18) FMA	f13 = ALPHA_I, f46, f13
	}
	;;
	{ .mmf
	(p16) LDFD	f32  = [X1], 1 * SIZE
	(p16) LDFD	f44  = [X2], 1 * SIZE
	(p18) FMA	f14 = ALPHA_I, f58, f14
	}
	{ .mmf
	(p19) add	YY3 = YY3, INCY7M1
	(p19) add	YY4 = YY4, INCY7M1
	(p18) FMA	f15 = ALPHA_I, f70, f15
	}
	;;
	{ .mmf
	(p18) STFD	[YY1] = f6,   1 * SIZE
 	(p18) STFD	[YY2] = f7,   1 * SIZE
	(p18) FMA	f6  = ALPHA_R, f37, f85
	}
	{ .mmf
	(p16) LDFD	f56  = [X3], 1 * SIZE
	(p16) LDFD	f68  = [X4], 1 * SIZE
	(p18) FMA	f7  = ALPHA_R, f49, f97
	}
	;;
	{ .mmf
	(p18) STFD	[YY3] = f10,  1 * SIZE
	(p18) STFD	[YY4] = f11,  1 * SIZE
	(p18) FMA	f10 = ALPHA_R, f61, f109
	}
	{ .mmf
	(p16) LDFD	f38  = [X1], INCXM1
	(p16) LDFD	f50  = [X2], INCXM1
	(p18) FMA	f11 = ALPHA_R, f73, f121
	}
	;;
	{ .mmf
	(p18) STFD	[YY1] = f12
	(p18) STFD	[YY2] = f13
	(p18) FMA2	f12 = ALPHA_R, f43, f91
	}
	{ .mmf
	(p16) LDFD	f62  = [X3], INCXM1
	(p16) LDFD	f74  = [X4], INCXM1
	(p18) FMA2	f13 = ALPHA_R, f55, f103
	}
	;;
	{ .mmf
	(p18) STFD	[YY3] = f14
	(p18) STFD	[YY4] = f15
	(p18) FMA2	f14 = ALPHA_R, f67, f115
	}
	{ .mmf
	(p16) LDFD	f83  = [Y1], 1 * SIZE
	(p16) LDFD	f95  = [Y2], 1 * SIZE
	(p18) FMA2	f15 = ALPHA_R, f79, f127
	}
	;;
	{ .mmf
	(p16) LDFD	f107 = [Y3], 1 * SIZE
	(p16) LDFD	f119 = [Y4], 1 * SIZE
	(p18) FMA1	f6  = ALPHA_I, f43, f6
	}
	{ .mmf
	nop	__LINE__
	nop	__LINE__
	(p18) FMA1	f7  = ALPHA_I, f55, f7
	}
	;;
	{ .mmf
	(p16) LDFD	f89  = [Y1], INCY7M1
	(p16) LDFD	f101 = [Y2], INCY7M1
	(p18) FMA1	f10 = ALPHA_I, f67, f10
	}
	{ .mmf
	(p18) add	YY1 = YY1, INCYM1
	(p18) add	YY2 = YY2, INCYM1
	(p18) FMA1	f11 = ALPHA_I, f79, f11
	}
	;;
	{ .mmf
	(p16) LDFD	f113 = [Y3], INCY7M1
	(p16) LDFD	f125 = [Y4], INCY7M1
	(p18) FMA	f12 = ALPHA_I, f37, f12
	}
	{ .mmf
	(p18) add	YY3 = YY3, INCYM1
	(p18) add	YY4 = YY4, INCYM1
	(p18) FMA	f13 = ALPHA_I, f49, f13
	}
	;;
	{ .mmf
	(p16) LDFD	f35  = [X1], 1 * SIZE
	(p16) LDFD	f47  = [X2], 1 * SIZE
	(p18) FMA	f14 = ALPHA_I, f61, f14
	}
	{ .mmf
	(p16) LDFD	f59  = [X3], 1 * SIZE
	(p16) LDFD	f71  = [X4], 1 * SIZE
	(p18) FMA	f15 = ALPHA_I, f73, f15
	}
	;;
	{ .mmf
	(p18) STFD	[YY1] = f6,  1 * SIZE
	(p18) STFD	[YY2] = f7,  1 * SIZE
	(p17) FMA	f6  = ALPHA_R, f33, f81
	}
	{ .mmf
	(p16) LDFD	f41  = [X1], INCX7M1
	(p16) LDFD	f53  = [X2], INCX7M1
	(p17) FMA	f7  = ALPHA_R, f45, f93
	}
	;;
	{ .mmf
	(p18) STFD	[YY3] = f10, 1 * SIZE
	(p18) STFD	[YY4] = f11, 1 * SIZE
	(p17) FMA	f10 = ALPHA_R, f57, f105
	}
	{ .mmf
	(p16) LDFD	f65  = [X3], INCX7M1
	(p16) LDFD	f77  = [X4], INCX7M1
	(p17) FMA	f11 = ALPHA_R, f69, f117
	}
	;;
	{ .mmf
	(p18) STFD	[YY1] = f12
	(p18) STFD	[YY2] = f13
	(p17) FMA2	f12 = ALPHA_R, f39, f87
	}
	{ .mfb
	(p16) lfetch.nt1 [PREX1], INCX8
	(p17) FMA2	f13 = ALPHA_R, f51, f99
	br.ctop.sptk.few .L22
	}
	;;
	(p19) add	YY1 = YY1, INCY7M1
	(p19) add	YY2 = YY2, INCY7M1
	;;
	{ .mmf
	(p19) STFD	[YY3] = f14
	(p19) STFD	[YY4] = f15
	}
	{ .mmf
	(p19) add	YY3 = YY3, INCY7M1
	(p19) add	YY4 = YY4, INCY7M1
	}
	;;
	.align 32

.L25:
	{ .mmi
	(p13) LDFD	f32 = [X1], 1 * SIZE
	(p13) LDFD	f36 = [X2], 1 * SIZE
	mov	ar.lc = ARLC
	}
	;;
	{ .mmi
	(p13) LDFD	f80 = [Y1], 1 * SIZE
	(p13) LDFD	f84 = [Y2], 1 * SIZE
	mov	pr = PR, -65474
	}
	;;
	{ .mmi
	(p13) LDFD	f33 = [X1], INCXM1
	(p13) LDFD	f37 = [X2], INCXM1
	cmp.eq	p12, p0 = r0, J
	}
	;;
	{ .mmb
	(p13) LDFD	f81 = [Y1], INCYM1
	(p13) LDFD	f85 = [Y2], INCYM1
	(p12) 	br.ret.sptk.many b0
	}
	;;
	{ .mmi
	(p13) LDFD	f34 = [X1], 1 * SIZE
	(p13) LDFD	f38 = [X2], 1 * SIZE
	tbit.z	p0, p14 = N, 1
	}
	;;
	{ .mmi
	(p13) LDFD	f82 = [Y1], 1 * SIZE
	(p13) LDFD	f86 = [Y2], 1 * SIZE
	tbit.z	p0, p15 = N, 0
	}
	;;
	{ .mmf
	(p13) LDFD	f35 = [X1], INCX3M1
	(p13) LDFD	f39 = [X2], INCX3M1
	(p13) FMA	f80  = ALPHA_R, f32, f80
	}
	;;
	{ .mmf
	(p13) LDFD	f83 = [Y1], INCY3M1
	(p13) LDFD	f87 = [Y2], INCY3M1
	(p13) FMA	f84  = ALPHA_R, f36, f84
	}
	;;
	{ .mmf
	(p14) LDFD	f40 = [X1], 1 * SIZE
	(p14) LDFD	f88 = [Y1], 1 * SIZE
	(p13) FMA2	f81  = ALPHA_R, f33, f81
	}
	;;
	{ .mmf
	(p14) LDFD	f41 = [X1], INCXM1
	(p14) LDFD	f89 = [Y1], INCYM1
	(p13) FMA2	f85  = ALPHA_R, f37, f85
	}
	;;
	{ .mmf
	(p14) LDFD	f42 = [X1], 1 * SIZE
	(p14) LDFD	f90 = [Y1], 1 * SIZE
	(p13) FMA	f82  = ALPHA_R, f34, f82
	}
	;;
	{ .mmf
	(p14) LDFD	f43 = [X1], INCXM1
	(p14) LDFD	f91 = [Y1], INCYM1
	(p13) FMA	f86  = ALPHA_R, f38, f86
	}
	;;
	{ .mmf
	(p15) LDFD	f44 = [X1], 1 * SIZE
	(p15) LDFD	f92 = [Y1], 1 * SIZE
	(p13) FMA2	f83  = ALPHA_R, f35, f83
	}
	;;
	{ .mmf
	(p15) LDFD	f45 = [X1]
	(p15) LDFD	f93 = [Y1]
	(p13) FMA2	f87  = ALPHA_R, f39, f87
	}
	;;
	(p13) FMA1	f80  = ALPHA_I, f33, f80
	(p13) FMA1	f84  = ALPHA_I, f37, f84
	(p13) FMA	f81  = ALPHA_I, f32, f81
	(p13) FMA	f85  = ALPHA_I, f36, f85
	(p13) FMA1	f82  = ALPHA_I, f35, f82
	(p13) FMA1	f86  = ALPHA_I, f39, f86
	(p13) FMA	f83  = ALPHA_I, f34, f83
	(p13) FMA	f87  = ALPHA_I, f38, f87
	;;
	{ .mmf
	(p13) STFD	[YY1] = f80,   1 * SIZE
	(p13) STFD	[YY2] = f84,   1 * SIZE
	(p14) FMA	f88  = ALPHA_R, f40, f88
	}
	;;
	{ .mmf
	(p13) STFD	[YY1] = f81
	(p13) STFD	[YY2] = f85
	(p14) FMA2	f89  = ALPHA_R, f41, f89
	}
	{ .mmf
	(p13) add	YY1 = YY1, INCYM1
	(p13) add	YY2 = YY2, INCYM1
	(p14) FMA	f90  = ALPHA_R, f42, f90
	}
	;;
	{ .mmf
	(p13) STFD	[YY1] = f82,   1 * SIZE
	(p13) STFD	[YY2] = f86,   1 * SIZE
	(p14) FMA2	f91  = ALPHA_R, f43, f91
	}
	;;
	{ .mmf
	(p13) STFD	[YY1] = f83
	(p13) STFD	[YY2] = f87
	(p15) FMA	f92  = ALPHA_R, f44, f92
	}
	{ .mmf
	(p13) add	YY1 = YY1, INCY3M1
	nop   __LINE__
	(p15) FMA2	f93  = ALPHA_R, f45, f93
	}
	;;
	(p14) FMA1	f88  = ALPHA_I, f41, f88
	(p14) FMA	f89  = ALPHA_I, f40, f89
	(p14) FMA1	f90  = ALPHA_I, f43, f90
	(p14) FMA	f91  = ALPHA_I, f42, f91
	;;
	{ .mmf
	(p14) STFD	[YY1] = f88,   1 * SIZE
	(p15) FMA1	f92  = ALPHA_I, f45, f92
	}
	;;
	{ .mmf
	(p14) STFD	[YY1] = f89
	(p14) add	YY1 = YY1, INCYM1
	(p15) FMA	f93  = ALPHA_I, f44, f93
	}
	;;
	(p14) STFD	[YY1] = f90,   1 * SIZE
	;;
	(p14) STFD	[YY1] = f91
	(p14) add	YY1 = YY1, INCYM1
	;;
	(p15) STFD	[YY1] = f92,   1 * SIZE
	;;
	{ .mmb
	(p15) STFD	[YY1] = f93
	nop   __LINE__
	br.ret.sptk.many b0
	}
	;;
	EPILOGUE