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
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
|
dnl IA-64 mpn_add_n/mpn_sub_n -- mpn addition and subtraction.
dnl Contributed to the GNU project by Torbjorn Granlund.
dnl Copyright 2003-2005, 2010, 2011 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C Itanium: 2.67
C Itanium 2: 1.25
C TODO
C * Consider using special code for small n, using something like
C "switch (8 * (n >= 8) + (n mod 8))" to enter it and feed-in code.
C * The non-nc code was trimmed cycle for cycle to its current state. It is
C probably hard to save more that an odd cycle there. The nc code is much
C cruder (since tune/speed doesn't have any applicable direct measurements).
C * Without the nc entry points, this becomes around 1800 bytes of object
C code; the nc code adds over 1000 bytes. We should perhaps sacrifice a
C few cycles for the non-nc code and let it fall into the nc code.
C INPUT PARAMETERS
define(`rp', `r32')
define(`up', `r33')
define(`vp', `r34')
define(`n', `r35')
define(`cy', `r36')
ifdef(`OPERATION_add_n',`
define(ADDSUB, add)
define(CND, ltu)
define(INCR, 1)
define(LIM, -1)
define(LIM2, 0)
define(func, mpn_add_n)
define(func_nc, mpn_add_nc)
')
ifdef(`OPERATION_sub_n',`
define(ADDSUB, sub)
define(CND, gtu)
define(INCR, -1)
define(LIM, 0)
define(LIM2, -1)
define(func, mpn_sub_n)
define(func_nc, mpn_sub_nc)
')
define(PFDIST, 500)
C Some useful aliases for registers we use
define(`u0',`r14') define(`u1',`r15') define(`u2',`r16') define(`u3',`r17')
define(`v0',`r24') define(`v1',`r25') define(`v2',`r26') define(`v3',`r27')
define(`w0',`r28') define(`w1',`r29') define(`w2',`r30') define(`w3',`r31')
define(`rpx',`r3')
define(`upadv',`r20') define(`vpadv',`r21')
MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
ASM_START()
PROLOGUE(func_nc)
.prologue
.save ar.lc, r2
.body
ifdef(`HAVE_ABI_32',`
addp4 rp = 0, rp C M I
addp4 up = 0, up C M I
nop.i 0
addp4 vp = 0, vp C M I
nop.m 0
zxt4 n = n C I
;;
')
{.mmi; ld8 r11 = [vp], 8 C M01
ld8 r10 = [up], 8 C M01
mov r2 = ar.lc C I0
}{.mmi; and r14 = 7, n C M I
cmp.lt p15, p14 = 8, n C M I
add n = -6, n C M I
;;
}{.mmi; add upadv = PFDIST, up C Merging these lines into the feed-in
add vpadv = PFDIST, vp C code could save a cycle per call at
mov r23 = cy C the expense of code size.
;;
}{.mmi; cmp.eq p6, p0 = 1, r14 C M I
cmp.eq p7, p0 = 2, r14 C M I
cmp.eq p8, p0 = 3, r14 C M I
}{.bbb; (p6) br.dptk .Lc001 C B
(p7) br.dptk .Lc010 C B
(p8) br.dptk .Lc011 C B
;;
}{.mmi; cmp.eq p9, p0 = 4, r14 C M I
cmp.eq p10, p0 = 5, r14 C M I
cmp.eq p11, p0 = 6, r14 C M I
}{.bbb; (p9) br.dptk .Lc100 C B
(p10) br.dptk .Lc101 C B
(p11) br.dptk .Lc110 C B
;;
}{.mmi; ld8 r19 = [vp], 8 C M01
ld8 r18 = [up], 8 C M01
cmp.ne p13, p0 = 0, cy C copy cy to p13 M I
}{.mmb; cmp.eq p12, p0 = 7, r14 C M I
nop 0
(p12) br.dptk .Lc111 C B
;;
}
.Lc000:
{.mmi; ld8 v3 = [vp], 8 C M01
ld8 u3 = [up], 8 C M01
shr.u n = n, 3 C I0
;;
}{.mmi; add vpadv = PFDIST, vp C M I
ld8 v0 = [vp], 8 C M01
mov ar.lc = n C I0
}{.mmi; ld8 u0 = [up], 8 C M01
ADDSUB w1 = r10, r11 C M I
nop 0
;;
}{.mmi; add upadv = PFDIST, up C M I
ld8 v1 = [vp], 8 C M01
cmp.CND p7, p0 = w1, r10 C M I
}{.mmi; ld8 u1 = [up], 8 C M01
ADDSUB w2 = r18, r19 C M I
add rpx = 8, rp C M I
;;
}{.mmi; ld8 v2 = [vp], 8 C M01
cmp.CND p8, p0 = w2, r18 C M I
(p13) cmpeqor p7, p0 = LIM, w1 C M I
}{.mmi; ld8 u2 = [up], 8 C M01
(p13) add w1 = INCR, w1 C M I
ADDSUB w3 = u3, v3 C M I
;;
}{.mmi; ld8 v3 = [vp], 8 C M01
cmp.CND p9, p0 = w3, u3 C M I
(p7) cmpeqor p8, p0 = LIM, w2 C M I
}{.mmb; ld8 u3 = [up], 8 C M01
(p7) add w2 = INCR, w2 C M I
br L(m0)
}
.Lc001:
{.mmi; (p15) ld8 v1 = [vp], 8 C M01
(p15) ld8 u1 = [up], 8 C M01
ADDSUB w0 = r10, r11 C M I
}{.mmb; nop 0
nop 0
(p15) br L(0)
;;
}{.mmi; cmp.ne p9, p0 = 0, r23 C M I
mov r8 = 0
cmp.CND p6, p0 = w0, r10 C M I
;;
}{.mmb; (p9) cmpeqor p6, p0 = LIM, w0 C M I
(p9) add w0 = INCR, w0 C M I
br L(cj1) C B
}
L(0):
{.mmi; ld8 v2 = [vp], 8 C M01
ld8 u2 = [up], 8 C M01
shr.u n = n, 3 C I0
;;
}{.mmi; ld8 v3 = [vp], 8 C M01
ld8 u3 = [up], 8 C M01
mov ar.lc = n C I0
}{.mmi; nop 0
cmp.ne p9, p0 = 0, r23 C M I
nop 0
;;
}{.mmi; ld8 v0 = [vp], 8 C M01
cmp.CND p6, p0 = w0, r10 C M I
add rpx = 16, rp C M I
}{.mmb; ld8 u0 = [up], 8 C M01
ADDSUB w1 = u1, v1 C M I
br L(c1) C B
}
.Lc010:
{.mmi; ld8 v0 = [vp], 8 C M01
ld8 u0 = [up], 8 C M01
mov r8 = 0 C M I
}{.mmb; ADDSUB w3 = r10, r11 C M I
cmp.ne p8, p0 = 0, r23 C M I
(p15) br L(1) C B
;;
}{.mmi; cmp.CND p9, p0 = w3, r10 C M I
ADDSUB w0 = u0, v0 C M I
(p8) add w3 = INCR, w3 C M I
;;
}{.mmb; cmp.CND p6, p0 = w0, u0 C M I
(p8) cmpeqor p9, p0 = LIM2, w3 C M I
br L(cj2) C B
}
L(1):
{.mmi; ld8 v1 = [vp], 8 C M01
ld8 u1 = [up], 8 C M01
shr.u n = n, 3 C I0
;;
}{.mmi; ld8 v2 = [vp], 8 C M01
ld8 u2 = [up], 8 C M01
mov ar.lc = n C I0
;;
}{.mmi; ld8 v3 = [vp], 8 C M01
ld8 u3 = [up], 8 C M01
cmp.CND p9, p0 = w3, r10 C M I
;;
}{.mmi; (p8) cmpeqor p9, p0 = LIM, w3 C M I
(p8) add w3 = INCR, w3 C M I
ADDSUB w0 = u0, v0 C M I
}{.mmb; add rpx = 24, rp C M I
nop 0
br L(m23) C B
}
.Lc011:
{.mmi; ld8 v3 = [vp], 8 C M01
ld8 u3 = [up], 8 C M01
shr.u n = n, 3 C I0
}{.mmi; ADDSUB w2 = r10, r11 C M I
cmp.ne p7, p0 = 0, r23 C M I
nop 0
;;
}{.mmb; ld8 v0 = [vp], 8 C M01
ld8 u0 = [up], 8 C M01
(p15) br L(2) C B
}{.mmi; cmp.CND p8, p0 = w2, r10 C M I
ADDSUB w3 = u3, v3 C M I
nop 0
;;
}{.mmb; (p7) cmpeqor p8, p0 = LIM, w2 C M I
(p7) add w2 = INCR, w2 C M I
br L(cj3) C B
}
L(2):
{.mmi; ld8 v1 = [vp], 8 C M01
ld8 u1 = [up], 8 C M01
ADDSUB w3 = u3, v3 C M I
;;
}{.mmi; ld8 v2 = [vp], 8 C M01
ld8 u2 = [up], 8 C M01
cmp.CND p8, p0 = w2, r10 C M I
;;
}{.mmi; ld8 v3 = [vp], 8 C M01
cmp.CND p9, p0 = w3, u3 C M I
mov ar.lc = n C I0
}{.mmi; ld8 u3 = [up], 8 C M01
(p7) cmpeqor p8, p0 = LIM, w2 C M I
(p7) add w2 = INCR, w2 C M I
;;
}{.mmi; add rpx = 32, rp C M I
st8 [rp] = w2, 8 C M23
(p8) cmpeqor p9, p0 = LIM, w3 C M I
}{.mmb; (p8) add w3 = INCR, w3 C M I
ADDSUB w0 = u0, v0 C M I
br L(m23)
}
.Lc100:
{.mmi; ld8 v2 = [vp], 8 C M01
ld8 u2 = [up], 8 C M01
shr.u n = n, 3 C I0
}{.mmi; ADDSUB w1 = r10, r11 C M I
nop 0
nop 0
;;
}{.mmi; ld8 v3 = [vp], 8 C M01
ld8 u3 = [up], 8 C M01
add rpx = 8, rp C M I
}{.mmi; cmp.ne p6, p0 = 0, r23 C M I
cmp.CND p7, p0 = w1, r10 C M I
nop 0
;;
}{.mmi; ld8 v0 = [vp], 8 C M01
ld8 u0 = [up], 8 C M01
ADDSUB w2 = u2, v2 C M I
}{.mmb; (p6) cmpeqor p7, p0 = LIM, w1 C M I
(p6) add w1 = INCR, w1 C M I
(p14) br L(cj4)
;;
}{.mmi; ld8 v1 = [vp], 8 C M01
ld8 u1 = [up], 8 C M01
mov ar.lc = n C I0
;;
}{.mmi; ld8 v2 = [vp], 8 C M01
cmp.CND p8, p0 = w2, u2 C M I
nop 0
}{.mmi; ld8 u2 = [up], 8 C M01
nop 0
ADDSUB w3 = u3, v3 C M I
;;
}{.mmi; ld8 v3 = [vp], 8 C M01
cmp.CND p9, p0 = w3, u3 C M I
(p7) cmpeqor p8, p0 = LIM, w2 C M I
}{.mmb; ld8 u3 = [up], 8 C M01
(p7) add w2 = INCR, w2 C M I
br L(m4)
}
.Lc101:
{.mmi; ld8 v1 = [vp], 8 C M01
ld8 u1 = [up], 8 C M01
shr.u n = n, 3 C I0
;;
}{.mmi; ld8 v2 = [vp], 8 C M01
ld8 u2 = [up], 8 C M01
mov ar.lc = n C I0
;;
}{.mmi; ld8 v3 = [vp], 8 C M01
ld8 u3 = [up], 8 C M01
ADDSUB w0 = r10, r11 C M I
}{.mmi; cmp.ne p9, p0 = 0, r23 C M I
add rpx = 16, rp C M I
nop 0
;;
}{.mmi; ld8 v0 = [vp], 8 C M01
ld8 u0 = [up], 8 C M01
cmp.CND p6, p0 = w0, r10 C M I
}{.mbb; ADDSUB w1 = u1, v1 C M I
(p15) br L(c5) C B
br L(end) C B
}
.Lc110:
{.mmi; ld8 v0 = [vp], 8 C M01
ld8 u0 = [up], 8 C M01
shr.u n = n, 3 C I0
;;
}{.mmi; add upadv = PFDIST, up C M I
add vpadv = PFDIST, vp C M I
mov ar.lc = n C I0
}{.mmi; ld8 v1 = [vp], 8 C M01
ld8 u1 = [up], 8 C M01
ADDSUB w3 = r10, r11 C M I
;;
}{.mmi; ld8 v2 = [vp], 8 C M01
ld8 u2 = [up], 8 C M01
ADDSUB w0 = u0, v0 C M I
}{.mmi; cmp.CND p9, p0 = w3, r10 C M I
cmp.ne p8, p0 = 0, r23 C M I
add rpx = 24, rp C M I
;;
}{.mmi; ld8 v3 = [vp], 8 C M01
ld8 u3 = [up], 8 C M01
nop 0
}{.mmb; (p8) cmpeqor p9, p0 = LIM, w3 C M I
(p8) add w3 = INCR, w3 C M I
br L(m67) C B
}
.Lc111:
{.mmi; ld8 v0 = [vp], 8 C M01
ld8 u0 = [up], 8 C M01
shr.u n = n, 3 C I0
;;
}{.mmi; add upadv = PFDIST, up C M I
ld8 v1 = [vp], 8 C M01
mov ar.lc = n C I0
}{.mmi; ld8 u1 = [up], 8 C M01
ADDSUB w2 = r10, r11 C M I
nop 0
;;
}{.mmi; add vpadv = PFDIST, vp C M I
ld8 v2 = [vp], 8 C M01
cmp.CND p8, p0 = w2, r10 C M I
}{.mmi; ld8 u2 = [up], 8 C M01
ADDSUB w3 = r18, r19 C M I
nop 0
;;
}{.mmi; ld8 v3 = [vp], 8 C M01
cmp.CND p9, p0 = w3, r18 C M I
(p13) cmpeqor p8, p0 = LIM, w2 C M I
}{.mmi; ld8 u3 = [up], 8 C M01
(p13) add w2 = INCR, w2 C M I
nop 0
;;
}{.mmi; add rpx = 32, rp C M I
st8 [rp] = w2, 8 C M23
(p8) cmpeqor p9, p0 = LIM, w3 C M I
}{.mmb; (p8) add w3 = INCR, w3 C M I
ADDSUB w0 = u0, v0 C M I
br L(m67)
}
EPILOGUE()
PROLOGUE(func)
.prologue
.save ar.lc, r2
.body
ifdef(`HAVE_ABI_32',`
addp4 rp = 0, rp C M I
addp4 up = 0, up C M I
nop.i 0
addp4 vp = 0, vp C M I
nop.m 0
zxt4 n = n C I
;;
')
{.mmi; ld8 r11 = [vp], 8 C M01
ld8 r10 = [up], 8 C M01
mov r2 = ar.lc C I0
}{.mmi; and r14 = 7, n C M I
cmp.lt p15, p14 = 8, n C M I
add n = -6, n C M I
;;
}{.mmi; cmp.eq p6, p0 = 1, r14 C M I
cmp.eq p7, p0 = 2, r14 C M I
cmp.eq p8, p0 = 3, r14 C M I
}{.bbb; (p6) br.dptk .Lb001 C B
(p7) br.dptk .Lb010 C B
(p8) br.dptk .Lb011 C B
;;
}{.mmi; cmp.eq p9, p0 = 4, r14 C M I
cmp.eq p10, p0 = 5, r14 C M I
cmp.eq p11, p0 = 6, r14 C M I
}{.bbb; (p9) br.dptk .Lb100 C B
(p10) br.dptk .Lb101 C B
(p11) br.dptk .Lb110 C B
;;
}{.mmi; ld8 r19 = [vp], 8 C M01
ld8 r18 = [up], 8 C M01
cmp.ne p13, p0 = r0, r0 C clear "CF" M I
}{.mmb; cmp.eq p12, p0 = 7, r14 C M I
mov r23 = 0 C M I
(p12) br.dptk .Lb111 C B
;;
}
.Lb000:
{.mmi; ld8 v3 = [vp], 8 C M01
ld8 u3 = [up], 8 C M01
shr.u n = n, 3 C I0
;;
}{.mmi; ld8 v0 = [vp], 8 C M01
ld8 u0 = [up], 8 C M01
ADDSUB w1 = r10, r11 C M I
;;
}{.mmi; ld8 v1 = [vp], 8 C M01
cmp.CND p7, p0 = w1, r10 C M I
mov ar.lc = n C I0
}{.mmi; ld8 u1 = [up], 8 C M01
ADDSUB w2 = r18, r19 C M I
add rpx = 8, rp C M I
;;
}{.mmi; add upadv = PFDIST, up
add vpadv = PFDIST, vp
cmp.CND p8, p0 = w2, r18 C M I
}{.mmi; ld8 v2 = [vp], 8 C M01
ld8 u2 = [up], 8 C M01
ADDSUB w3 = u3, v3 C M I
;;
}{.mmi; ld8 v3 = [vp], 8 C M01
cmp.CND p9, p0 = w3, u3 C M I
(p7) cmpeqor p8, p0 = LIM, w2 C M I
}{.mmb; ld8 u3 = [up], 8 C M01
(p7) add w2 = INCR, w2 C M I
br L(m0) C B
}
ALIGN(32)
.Lb001:
{.mmi; ADDSUB w0 = r10, r11 C M I
(p15) ld8 v1 = [vp], 8 C M01
mov r8 = 0 C M I
;;
}{.mmb; cmp.CND p6, p0 = w0, r10 C M I
(p15) ld8 u1 = [up], 8 C M01
(p14) br L(cj1) C B
;;
}{.mmi; add upadv = PFDIST, up
add vpadv = PFDIST, vp
shr.u n = n, 3 C I0
}{.mmi; ld8 v2 = [vp], 8 C M01
ld8 u2 = [up], 8 C M01
cmp.CND p6, p0 = w0, r10 C M I
;;
}{.mmi; ld8 v3 = [vp], 8 C M01
ld8 u3 = [up], 8 C M01
mov ar.lc = n C I0
;;
}{.mmi; ld8 v0 = [vp], 8 C M01
ld8 u0 = [up], 8 C M01
ADDSUB w1 = u1, v1 C M I
;;
}{.mmi; ld8 v1 = [vp], 8 C M01
cmp.CND p7, p0 = w1, u1 C M I
ADDSUB w2 = u2, v2 C M I
}{.mmb; ld8 u1 = [up], 8 C M01
add rpx = 16, rp C M I
br L(m1) C B
}
ALIGN(32)
.Lb010:
{.mmi; ld8 v0 = [vp], 8 C M01
ld8 u0 = [up], 8 C M01
shr.u n = n, 3 C I0
}{.mmb; ADDSUB w3 = r10, r11 C M I
nop 0
(p15) br L(gt2) C B
;;
}{.mmi; cmp.CND p9, p0 = w3, r10 C M I
ADDSUB w0 = u0, v0 C M I
mov r8 = 0 C M I
;;
}{.mmb; nop 0
cmp.CND p6, p0 = w0, u0 C M I
br L(cj2) C B
}
L(gt2):
{.mmi; ld8 v1 = [vp], 8 C M01
ld8 u1 = [up], 8 C M01
nop 0
;;
}{.mmi; add upadv = PFDIST, up
add vpadv = PFDIST, vp
mov ar.lc = n C I0
}{.mmi; ld8 v2 = [vp], 8 C M01
ld8 u2 = [up], 8 C M01
nop 0
;;
}{.mmi; ld8 v3 = [vp], 8 C M01
cmp.CND p9, p0 = w3, r10 C M I
ADDSUB w0 = u0, v0 C M I
}{.mmb; ld8 u3 = [up], 8 C M01
add rpx = 24, rp C M I
br L(m23) C B
}
ALIGN(32)
.Lb011:
{.mmi; ld8 v3 = [vp], 8 C M01
ld8 u3 = [up], 8 C M01
ADDSUB w2 = r10, r11 C M I
;;
}{.mmb; ld8 v0 = [vp], 8 C M01
ld8 u0 = [up], 8 C M01
(p15) br L(3) C B
}{.mmb; cmp.CND p8, p0 = w2, r10 C M I
ADDSUB w3 = u3, v3 C M I
br L(cj3) C B
}
L(3):
{.mmi; ld8 v1 = [vp], 8 C M01
ld8 u1 = [up], 8 C M01
shr.u n = n, 3 C I0
;;
}{.mmi; add upadv = PFDIST, up
add vpadv = PFDIST, vp
ADDSUB w3 = u3, v3 C M I
}{.mmi; ld8 v2 = [vp], 8 C M01
ld8 u2 = [up], 8 C M01
cmp.CND p8, p0 = w2, r10 C M I
;;
}{.mmi; ld8 v3 = [vp], 8 C M01
cmp.CND p9, p0 = w3, u3 C M I
mov ar.lc = n C I0
}{.mmi; ld8 u3 = [up], 8 C M01
nop 0
nop 0
;;
}{.mmi; add rpx = 32, rp C M I
st8 [rp] = w2, 8 C M23
(p8) cmpeqor p9, p0 = LIM, w3 C M I
}{.mmb; (p8) add w3 = INCR, w3 C M I
ADDSUB w0 = u0, v0 C M I
br L(m23) C B
}
ALIGN(32)
.Lb100:
{.mmi; ld8 v2 = [vp], 8 C M01
ld8 u2 = [up], 8 C M01
shr.u n = n, 3 C I0
;;
}{.mmi; ld8 v3 = [vp], 8 C M01
ld8 u3 = [up], 8 C M01
ADDSUB w1 = r10, r11 C M I
;;
}{.mmi; ld8 v0 = [vp], 8 C M01
ld8 u0 = [up], 8 C M01
cmp.CND p7, p0 = w1, r10 C M I
}{.mmb; nop 0
ADDSUB w2 = u2, v2 C M I
(p14) br L(cj4) C B
;;
}
L(gt4):
{.mmi; add upadv = PFDIST, up
add vpadv = PFDIST, vp
mov ar.lc = n C I0
}{.mmi; ld8 v1 = [vp], 8 C M01
ld8 u1 = [up], 8 C M01
nop 0
;;
}{.mmi; ld8 v2 = [vp], 8 C M01
cmp.CND p8, p0 = w2, u2 C M I
nop 0
}{.mmi; ld8 u2 = [up], 8 C M01
ADDSUB w3 = u3, v3 C M I
add rpx = 8, rp C M I
;;
}{.mmi; ld8 v3 = [vp], 8 C M01
cmp.CND p9, p0 = w3, u3 C M I
(p7) cmpeqor p8, p0 = LIM, w2 C M I
}{.mmb; ld8 u3 = [up], 8 C M01
(p7) add w2 = INCR, w2 C M I
br L(m4) C B
}
ALIGN(32)
.Lb101:
{.mmi; ld8 v1 = [vp], 8 C M01
ld8 u1 = [up], 8 C M01
shr.u n = n, 3 C I0
;;
}{.mmi; ld8 v2 = [vp], 8 C M01
ld8 u2 = [up], 8 C M01
ADDSUB w0 = r10, r11 C M I
;;
}{.mmi; add upadv = PFDIST, up
add vpadv = PFDIST, vp
add rpx = 16, rp C M I
}{.mmi; ld8 v3 = [vp], 8 C M01
ld8 u3 = [up], 8 C M01
nop 0
;;
}{.mmi; ld8 v0 = [vp], 8 C M01
cmp.CND p6, p0 = w0, r10 C M I
nop 0
}{.mmb; ld8 u0 = [up], 8 C M01
ADDSUB w1 = u1, v1 C M I
(p14) br L(cj5) C B
;;
}
L(gt5):
{.mmi; ld8 v1 = [vp], 8 C M01
cmp.CND p7, p0 = w1, u1 C M I
mov ar.lc = n C I0
}{.mmb; ld8 u1 = [up], 8 C M01
ADDSUB w2 = u2, v2 C M I
br L(m5) C B
}
ALIGN(32)
.Lb110:
{.mmi; ld8 v0 = [vp], 8 C M01
ld8 u0 = [up], 8 C M01
shr.u n = n, 3 C I0
;;
}{.mmi; ld8 v1 = [vp], 8 C M01
ld8 u1 = [up], 8 C M01
ADDSUB w3 = r10, r11 C M I
;;
}{.mmi; add upadv = PFDIST, up
add vpadv = PFDIST, vp
mov ar.lc = n C I0
}{.mmi; ld8 v2 = [vp], 8 C M01
ld8 u2 = [up], 8 C M01
nop 0
;;
}{.mmi; ld8 v3 = [vp], 8 C M01
cmp.CND p9, p0 = w3, r10 C M I
ADDSUB w0 = u0, v0 C M I
}{.mmb; ld8 u3 = [up], 8 C M01
add rpx = 24, rp C M I
br L(m67) C B
}
ALIGN(32)
.Lb111:
{.mmi; ld8 v0 = [vp], 8 C M01
ld8 u0 = [up], 8 C M01
shr.u n = n, 3 C I0
;;
}{.mmi; ld8 v1 = [vp], 8 C M01
ld8 u1 = [up], 8 C M01
ADDSUB w2 = r10, r11 C M I
;;
}{.mmi; ld8 v2 = [vp], 8 C M01
cmp.CND p8, p0 = w2, r10 C M I
mov ar.lc = n C I0
}{.mmi; ld8 u2 = [up], 8 C M01
ADDSUB w3 = r18, r19 C M I
nop 0
;;
}{.mmi; add upadv = PFDIST, up
add vpadv = PFDIST, vp
nop 0
}{.mmi; ld8 v3 = [vp], 8 C M01
ld8 u3 = [up], 8 C M01
cmp.CND p9, p0 = w3, r18 C M I
;;
}{.mmi; add rpx = 32, rp C M I
st8 [rp] = w2, 8 C M23
(p8) cmpeqor p9, p0 = LIM, w3 C M I
}{.mmb; (p8) add w3 = INCR, w3 C M I
ADDSUB w0 = u0, v0 C M I
br L(m67) C B
}
C *** MAIN LOOP START ***
ALIGN(32)
L(top):
L(c5): ld8 v1 = [vp], 8 C M01
cmp.CND p7, p0 = w1, u1 C M I
(p9) cmpeqor p6, p0 = LIM, w0 C M I
ld8 u1 = [up], 8 C M01
(p9) add w0 = INCR, w0 C M I
ADDSUB w2 = u2, v2 C M I
;;
L(m5): ld8 v2 = [vp], 8 C M01
cmp.CND p8, p0 = w2, u2 C M I
(p6) cmpeqor p7, p0 = LIM, w1 C M I
ld8 u2 = [up], 8 C M01
(p6) add w1 = INCR, w1 C M I
ADDSUB w3 = u3, v3 C M I
;;
st8 [rp] = w0, 8 C M23
ld8 v3 = [vp], 8 C M01
cmp.CND p9, p0 = w3, u3 C M I
(p7) cmpeqor p8, p0 = LIM, w2 C M I
ld8 u3 = [up], 8 C M01
(p7) add w2 = INCR, w2 C M I
;;
L(m4): st8 [rp] = w1, 16 C M23
st8 [rpx] = w2, 32 C M23
(p8) cmpeqor p9, p0 = LIM, w3 C M I
lfetch [upadv], 64
(p8) add w3 = INCR, w3 C M I
ADDSUB w0 = u0, v0 C M I
;;
L(m23): st8 [rp] = w3, 8 C M23
ld8 v0 = [vp], 8 C M01
cmp.CND p6, p0 = w0, u0 C M I
ld8 u0 = [up], 8 C M01
ADDSUB w1 = u1, v1 C M I
nop.b 0
;;
L(c1): ld8 v1 = [vp], 8 C M01
cmp.CND p7, p0 = w1, u1 C M I
(p9) cmpeqor p6, p0 = LIM, w0 C M I
ld8 u1 = [up], 8 C M01
(p9) add w0 = INCR, w0 C M I
ADDSUB w2 = u2, v2 C M I
;;
L(m1): ld8 v2 = [vp], 8 C M01
cmp.CND p8, p0 = w2, u2 C M I
(p6) cmpeqor p7, p0 = LIM, w1 C M I
ld8 u2 = [up], 8 C M01
(p6) add w1 = INCR, w1 C M I
ADDSUB w3 = u3, v3 C M I
;;
st8 [rp] = w0, 8 C M23
ld8 v3 = [vp], 8 C M01
cmp.CND p9, p0 = w3, u3 C M I
(p7) cmpeqor p8, p0 = LIM, w2 C M I
ld8 u3 = [up], 8 C M01
(p7) add w2 = INCR, w2 C M I
;;
L(m0): st8 [rp] = w1, 16 C M23
st8 [rpx] = w2, 32 C M23
(p8) cmpeqor p9, p0 = LIM, w3 C M I
lfetch [vpadv], 64
(p8) add w3 = INCR, w3 C M I
ADDSUB w0 = u0, v0 C M I
;;
L(m67): st8 [rp] = w3, 8 C M23
ld8 v0 = [vp], 8 C M01
cmp.CND p6, p0 = w0, u0 C M I
ld8 u0 = [up], 8 C M01
ADDSUB w1 = u1, v1 C M I
br.cloop.dptk L(top) C B
;;
C *** MAIN LOOP END ***
L(end):
{.mmi; (p9) cmpeqor p6, p0 = LIM, w0 C M I
(p9) add w0 = INCR, w0 C M I
mov ar.lc = r2 C I0
}
L(cj5):
{.mmi; cmp.CND p7, p0 = w1, u1 C M I
ADDSUB w2 = u2, v2 C M I
nop 0
;;
}{.mmi; st8 [rp] = w0, 8 C M23
(p6) cmpeqor p7, p0 = LIM, w1 C M I
(p6) add w1 = INCR, w1 C M I
}
L(cj4):
{.mmi; cmp.CND p8, p0 = w2, u2 C M I
ADDSUB w3 = u3, v3 C M I
nop 0
;;
}{.mmi; st8 [rp] = w1, 8 C M23
(p7) cmpeqor p8, p0 = LIM, w2 C M I
(p7) add w2 = INCR, w2 C M I
}
L(cj3):
{.mmi; cmp.CND p9, p0 = w3, u3 C M I
ADDSUB w0 = u0, v0 C M I
nop 0
;;
}{.mmi; st8 [rp] = w2, 8 C M23
(p8) cmpeqor p9, p0 = LIM, w3 C M I
(p8) add w3 = INCR, w3 C M I
}{.mmi; cmp.CND p6, p0 = w0, u0 C M I
nop 0
mov r8 = 0 C M I
;;
}
L(cj2):
{.mmi; st8 [rp] = w3, 8 C M23
(p9) cmpeqor p6, p0 = LIM, w0 C M I
(p9) add w0 = INCR, w0 C M I
;;
}
L(cj1):
{.mmb; st8 [rp] = w0, 8 C M23
(p6) mov r8 = 1 C M I
br.ret.sptk.many b0 C B
}
EPILOGUE()
ASM_END()
|