summaryrefslogtreecommitdiff
path: root/kernel/ia64/zscal.S
blob: 1acc0ed4f5a3dc12e4db1cf8af9370a772c8c2ad (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
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
/*********************************************************************/
/* 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"

#ifdef XDOUBLE
#define PREFETCH_SIZE ( 8 * 16)
#elif defined(DOUBLE)
#define PREFETCH_SIZE (16 * 16)
#else
#define PREFETCH_SIZE (32 * 16)
#endif

#define SP	r12

#ifdef XDOUBLE
#define N	r32
#define X1	r14
#define INCX	r15
#else
#define N	r32
#define X1	r37
#define INCX	r38
#endif

#define X2		r16
#define Y1		r17
#define INCX3		r18
#define PRE		r19
#define INCX8		r20
#define I		r29
#define J		r28

#define PR		r30
#define ARLC		r31

#define ALPHA_R		f8
#define ALPHA_I		f9

	PROLOGUE
	.prologue
	PROFCODE
	{.mmi
	adds	r22 = 16, SP
	adds	r23 = 24, SP
	mov	PR = pr
	}
	{ .mib
	cmp.ge	p7, p0 = 0, N
	shr	I = N, 3
	(p7) br.ret.sptk.many b0
	}
	;;
#ifdef XDOUBLE
	{ .mmi
	ld8	X1     = [r22]
	ld8	INCX   = [r23]
	nop	__LINE__
	}
	;;
#endif
	{ .mfi
	and	J = 7, N
 	fcmp.eq	p0, p11 = ALPHA_I, f0
	.save	ar.lc, ARLC
	mov	ARLC = ar.lc
	}
	{ .mfi
	adds	I = -1, I
	fcmp.eq	p0, p10 = ALPHA_R, f0
	shl	INCX = INCX, ZBASE_SHIFT
	}
	;;
	.body
	{ .mmi
	shladd	INCX8 = INCX, 3, r0
	shladd	X2 = INCX, 1, X1
	mov	pr.rot= 0
	}
	{ .mmi
	shladd	INCX3 = INCX, 1, INCX
	adds	PRE = PREFETCH_SIZE * SIZE, X1
	mov	Y1 = X1
	}
	;;
	{ .mmi
	cmp.gt	p8, p0 = 0, I
	cmp.ge	p9, p0 = 0, J
	mov	ar.lc = I
	}
	{ .mmi
	adds	INCX =  -1 * SIZE, INCX
	adds	INCX3 = -1 * SIZE, INCX3
	tbit.z	p0, p13 = N, 2
	}
	;;
	{ .bbb
	(p10) br.cond.dptk .L100
	(p11) br.cond.dptk .L100
	(p8)  br.cond.dpnt .L20
	}
	;;
	.align 32

.L10:
	{ .mmb
	STFD	[X1] = f0, 1 * SIZE
	STFD	[X2] = f0, 1 * SIZE
	nop.b	0
	}
	{ .mmb
	lfetch.excl.nt1	[PRE], INCX8
	nop.m	0
	}
	;;
	{ .mmb
	STFD	[X1] = f0
	add	X1 = INCX, X1
	}
	{ .mmb
	STFD	[X2] = f0
	add	X2 = INCX, X2
	}
	;;
	{ .mmb
	STFD	[X1] = f0, 1 * SIZE
	STFD	[X2] = f0, 1 * SIZE
	nop.b	0
	}
	;;
	{ .mmb
	STFD	[X1] = f0
	add	X1 = INCX3, X1
	}
	{ .mmb
	STFD	[X2] = f0
	add	X2 = INCX3, X2
	}
	;;
	{ .mmb
	STFD	[X1] = f0, 1 * SIZE
	STFD	[X2] = f0, 1 * SIZE
	nop.b	0
	}
	;;
	{ .mmb
	STFD	[X1] = f0
	add	X1 = INCX, X1
	}
	{ .mmb
	STFD	[X2] = f0
	add	X2 = INCX, X2
	}
	;;
	{ .mmb
	STFD	[X1] = f0, 1 * SIZE
	STFD	[X2] = f0, 1 * SIZE
	nop.b	0
	}
	;;
	{ .mmb
	STFD	[X1] = f0
	add	X1 = INCX3, X1
	}
	{ .mmb
	STFD	[X2] = f0
	add	X2 = INCX3, X2
	br.cloop.sptk.few .L10
	}
	;;
	.align 32

.L20:
	{ .mmi
	(p13) STFD	[X1] = f0, 1 * SIZE
	(p13) STFD	[X2] = f0, 1 * SIZE
	mov	ar.lc = ARLC
	}
	;;
	{ .mmi
	(p13) STFD	[X1] = f0
	(p13) add	X1 = INCX, X1
	tbit.z	p0, p14 = N, 1
	}
	{ .mmi
	(p13) STFD	[X2] = f0
	(p13) add	X2 = INCX, X2
	tbit.z	p0, p15 = N, 0
	}
	;;
	{ .mmb
	(p13) STFD	[X1] = f0, 1 * SIZE
	(p13) STFD	[X2] = f0, 1 * SIZE
	nop.b 0
	}
	{ .mib
	nop.m	0
	mov	pr = PR, -65474
	(p9) br.ret.sptk.many b0
	}
	;;
	{ .mmb
	(p13) STFD	[X1] = f0
	(p13) add	X1 = INCX3, X1
	}
	{ .mmb
	(p13) STFD	[X2] = f0
	(p13) add	X2 = INCX3, X2
	}
	;;
	(p14) STFD	[X1] = f0, 1 * SIZE
	;;
	{ .mmb
	(p14) STFD	[X1] = f0
	(p14) add	X1 = INCX, X1
	}
	;;
	(p14) STFD	[X1] = f0, 1 * SIZE
	;;
	{ .mmb
	(p14) STFD	[X1] = f0
	(p14) add	X1 = INCX, X1
	}
	;;
	(p15) STFD	[X1] = f0, 1 * SIZE
	;;
	{ .mib
	(p15) STFD	[X1] = f0
	mov	pr = PR, -65474
	br.ret.sptk.many b0
	}
	;;
	.align 32

.L100:
	cmp.eq	p16, p0 = r0, r0
	mov.i	ar.ec = 6
	(p8) br.cond.dpnt .L170
	;;
	.align 32

.L160:
	{ .mmf
	(p21) STFD	[X1] = f6,  1 * SIZE
	(p16) lfetch.excl.nt1	[PRE], INCX8
	(p21) FMS	f12  = ALPHA_R, f85,  f12
	}
	{ .mfb
	(p16) LDFD	f32  = [Y1], 1 * SIZE
	(p20) FMPY	f6   = ALPHA_I, f42
	}
	;;
	{ .mmf
	(p21) STFD	[X1] = f43
	(p21) add X1 = INCX, X1
	(p21) FMA	f91  = ALPHA_I, f85,  f91
	}
	{ .mfb
	(p16) LDFD	f38  = [Y1], INCX
	(p20) FMPY	f42  = ALPHA_R, f42
	}
	;;
	{ .mmf
	(p21) STFD	[X1] = f7,  1 * SIZE
	(p21) FMS	f13  = ALPHA_R, f97,  f13
	}
	{ .mfb
	(p16) LDFD	f44  = [Y1], 1 * SIZE
	(p20) FMPY	f7   = ALPHA_I, f54
	}
	;;
	{ .mmf
	(p21) STFD	[X1] = f55
	(p21) add X1 = INCX, X1
	(p21) FMA	f103 = ALPHA_I, f97,  f103
	}
	{ .mfb
	(p16) LDFD	f50  = [Y1], INCX
	(p20) FMPY	f54  = ALPHA_R, f54
	}
	;;
	{ .mmf
	(p21) STFD	[X1] = f10, 1 * SIZE
	(p21) FMS	f14  = ALPHA_R, f109, f14
	}
	{ .mfb
	(p16) LDFD	f56  = [Y1], 1 * SIZE
	(p20) FMPY	f10  = ALPHA_I, f66
	}
	;;
	{ .mmf
	(p21) STFD	[X1] = f67
	(p21) add X1 = INCX, X1
	(p21) FMA	f115 = ALPHA_I, f109, f115
	}
	{ .mfb
	(p16) LDFD	f62  = [Y1], INCX
	(p20) FMPY	f66  = ALPHA_R, f66
	}
	;;
	{ .mmf
	(p21) STFD	[X1] = f11, 1 * SIZE
	(p21) FMS	f15  = ALPHA_R, f121, f15
	}
	{ .mfb
	(p16) LDFD	f68  = [Y1], 1 * SIZE
	(p20) FMPY	f11  = ALPHA_I, f78
	}
	;;
	{ .mmf
	(p21) STFD	[X1] = f79
	(p21) add X1 = INCX, X1
	(p21) FMA	f127 = ALPHA_I, f121, f127
	}
	{ .mfb
	(p16) LDFD	f74  = [Y1], INCX
	(p20) FMPY	f78  = ALPHA_R, f78
	}
	;;
	{ .mmf
	(p21) STFD	[X1] = f12, 1 * SIZE
	(p20) FMS	f6   = ALPHA_R, f36, f6
	}
	{ .mfb
	(p16) LDFD	f80  = [Y1], 1 * SIZE
	(p20) FMPY	f12  = ALPHA_I, f90
	}
	;;
	{ .mmf
	(p21) STFD	[X1] = f91
	(p21) add X1 = INCX, X1
	(p20) FMA	f42  = ALPHA_I, f36, f42
	}
	{ .mfb
	(p16) LDFD	f86  = [Y1], INCX
	(p20) FMPY	f90  = ALPHA_R, f90
	}
	;;
	{ .mmf
	(p21) STFD	[X1] = f13, 1 * SIZE
	(p20) FMS	f7   = ALPHA_R, f48, f7
	}
	{ .mfb
	(p16) LDFD	f92  = [Y1], 1 * SIZE
	(p20) FMPY	f13  = ALPHA_I, f102
	}
	;;
	{ .mmf
	(p21) STFD	[X1] = f103
	(p21) add X1 = INCX, X1
	(p20) FMA	f54  = ALPHA_I, f48, f54
	}
	{ .mfb
	(p16) LDFD	f98  = [Y1], INCX
	(p20) FMPY	f102 = ALPHA_R, f102
	}
	;;
	{ .mmf
	(p21) STFD	[X1] = f14, 1 * SIZE
	(p20) FMS	f10  = ALPHA_R, f60, f10
	}
	{ .mfb
	(p16) LDFD	f104 = [Y1], 1 * SIZE
	(p20) FMPY	f14  = ALPHA_I, f114
	}
	;;
	{ .mmf
	(p21) STFD	[X1] = f115
	(p21) add X1 = INCX, X1
	(p20) FMA	f66  = ALPHA_I, f60, f66
	}
	{ .mfb
	(p16) LDFD	f110 = [Y1], INCX
	(p20) FMPY	f114 = ALPHA_R, f114
	}
	;;
	{ .mmf
	(p21) STFD	[X1] = f15, 1 * SIZE
	(p20) FMS	f11  = ALPHA_R, f72, f11
	}
	{ .mfb
	(p16) LDFD	f116 = [Y1], 1 * SIZE
	(p20) FMPY	f15  = ALPHA_I, f126
	}
	;;
	{ .mmf
	(p21) STFD	[X1] = f127
	(p21) add X1 = INCX, X1
	(p20) FMA	f78  = ALPHA_I, f72, f78
	}
	{ .mfb
	(p16) LDFD	f122 = [Y1], INCX
	(p20) FMPY	f126 = ALPHA_R, f126
	br.ctop.sptk.few .L160
	}
	;;
	.align 16

.L170:
	{ .mmi
	(p13) LDFD	f48 = [Y1], 1 * SIZE
	mov	ar.lc = ARLC
	}
	;;
	{ .mib
	(p13) LDFD	f49 = [Y1], INCX
	mov	pr = PR, -65474
	(p9) br.ret.sptk.many b0
	}
	;;
	(p13) LDFD	f50 = [Y1], 1 * SIZE
	tbit.z	p0, p14 = N, 1
	;;
	(p13) LDFD	f51 = [Y1], INCX
	tbit.z	p0, p15 = N, 0
	;;
	(p13) LDFD	f52 = [Y1], 1 * SIZE
	;;
	(p13) LDFD	f53 = [Y1], INCX
	;;
	(p13) LDFD	f54 = [Y1], 1 * SIZE
	(p13) FMPY	f112 = ALPHA_I, f48
	;;
	(p13) LDFD	f55 = [Y1], INCX
	(p13) FMPY	f111 = ALPHA_I, f49
	;;
	(p14) LDFD	f56 = [Y1], 1 * SIZE
	(p13) FMPY	f114 = ALPHA_I, f50
	;;
	(p14) LDFD	f57 = [Y1], INCX
	(p13) FMPY	f113 = ALPHA_I, f51
	;;
	(p14) LDFD	f58 = [Y1], 1 * SIZE
	(p13) FMPY	f116 = ALPHA_I, f52
	;;
	(p14) LDFD	f59 = [Y1], INCX
	(p13) FMPY	f115 = ALPHA_I, f53
	;;
	(p15) LDFD	f60 = [Y1], 1 * SIZE
	(p13) FMPY	f118 = ALPHA_I, f54
	;;
	(p15) LDFD	f61 = [Y1], INCX
	(p13) FMPY	f117 = ALPHA_I, f55
	;;
	(p14) FMPY	f120 = ALPHA_I, f56
	(p14) FMPY	f119 = ALPHA_I, f57
	(p14) FMPY	f122 = ALPHA_I, f58
	(p14) FMPY	f121 = ALPHA_I, f59
	(p15) FMPY	f124 = ALPHA_I, f60
	(p15) FMPY	f123 = ALPHA_I, f61
	;;
	(p13) FMS	f48  = ALPHA_R, f48, f111
	(p13) FMA	f49  = ALPHA_R, f49, f112
	(p13) FMS	f50  = ALPHA_R, f50, f113
	(p13) FMA	f51  = ALPHA_R, f51, f114

	;;
	(p13) STFD	[X1] = f48, 1 * SIZE
	(p13) FMS	f52  = ALPHA_R, f52, f115
	;;
	(p13) STFD	[X1] = f49
	(p13) add X1 = INCX, X1
	(p13) FMA	f53  = ALPHA_R, f53, f116
	;;
	(p13) STFD	[X1] = f50, 1 * SIZE
	(p13) FMS	f54  = ALPHA_R, f54, f117
	;;
	(p13) STFD	[X1] = f51
	(p13) add X1 = INCX, X1
	(p13) FMA	f55  = ALPHA_R, f55, f118
	;;
	(p13) STFD	[X1] = f52, 1 * SIZE
	(p14) FMS	f56  = ALPHA_R, f56, f119
	;;
	(p13) STFD	[X1] = f53
	(p13) add X1 = INCX, X1
	(p14) FMA	f57  = ALPHA_R, f57, f120
	;;
	(p13) STFD	[X1] = f54, 1 * SIZE
	(p14) FMS	f58  = ALPHA_R, f58, f121
	;;
	(p13) STFD	[X1] = f55
	(p13) add X1 = INCX, X1
	(p14) FMA	f59  = ALPHA_R, f59, f122
	;;
	(p14) STFD	[X1] = f56, 1 * SIZE
	(p15) FMS	f60  = ALPHA_R, f60, f123
	;;
	(p14) STFD	[X1] = f57
	(p14) add X1 = INCX, X1
	(p15) FMA	f61  = ALPHA_R, f61, f124
	;;
	(p14) STFD	[X1] = f58, 1 * SIZE
	;;
	(p14) STFD	[X1] = f59
	(p14) add X1 = INCX, X1
	;;
	(p15) STFD	[X1] = f60, 1 * SIZE
	;;
	(p15) STFD	[X1] = f61
	mov	pr = PR, -65474
	br.ret.sptk.many b0

	EPILOGUE