This repository has been archived by the owner on Jun 5, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
routines-ppc64el.asm
executable file
·1434 lines (1301 loc) · 37.5 KB
/
routines-ppc64el.asm
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
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#============================================================================
# ppc64el routines for bandwidth, a benchmark to estimate memory transfer bandwidth.
# Copyright (c) 2015 Raptor Engineering
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either ver4on 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# The author of this file may be reached at tpearson@raptorengineeringinc.com.
#=============================================================================
.global ReaderLODSQ
.global _ReaderLODSQ
.global ReaderLODSD
.global _ReaderLODSD
.global ReaderLODSW
.global _ReaderLODSW
.global ReaderLODSB
.global _ReaderLODSB
.global RandomReader
.global RandomWriter
.global Reader
.global Reader_128bytes
.global RandomReaderVSX
.global ReaderVSX
.global RegisterToRegister
.global RegisterToVector
.global StackReader
.global StackWriter
.global VectorToRegister
.global VectorToVector
.global Writer
.global Writer_128bytes
.global WriterVSX
.global RandomWriterVSX
.global _RandomReader
.global _RandomWriter
.global _Reader
.global _Reader_128bytes
.global _RandomReaderVSX
.global _ReaderVSX
.global _RegisterToRegister
.global _RegisterToVector
.global _StackReader
.global _StackWriter
.global _VectorToRegister
.global _VectorToVector
.global _Writer
.global _Writer_128bytes
.global _WriterVSX
.global _RandomWriterVSX
.data
.align 3 # align to 8 byte boundary
stack_test_1:
.quad 1000
stack_test_2:
.quad 2000
stack_test_3:
.quad 3000
stack_test_4:
.quad 4000
stack_test_5:
.quad 5000
stack_test_6:
.quad 6000
stack_test_7:
.quad 7000
# Note:
# Unix ABI for 64-bit PPC64EL v2 says integer parameters are put into these registers in this order:
# r3, r4, r5, r6, r7, r7
.text
#------------------------------------------------------------------------------
# Name: ReaderLODSQ
# Purpose: Reads 64-bit values sequentially from an area of memory
# using LD instruction.
# Params: r3 = ptr to memory area
# r4 = length in bytes (inner loop count)
# r5 = loops (outer loop count)
#------------------------------------------------------------------------------
.align 2 # align to 4 byte boundary
ReaderLODSQ:
_ReaderLODSQ:
stdu r1, -32(r1) # update and store stack pointer
mflr r0 # set up the stack frame
std r0, 16(r1) # save the link register
mr r7, r4 # calculate inner loop count
srdi r7, r7, 3 # length in quadwords rounded down
mr r10, r5 # load outer loop counter
.Louter_loop_0:
addi r10, r10, -1
mtctr r7 # copy inner loop count to count register
mr r9, r3 # (re)load inner loop pointer address
.Linner_loop_0:
ld r8, 0(r9)
addi r9, r9, 8 # increment pointer by 1 quadword
bdnz .Linner_loop_0
cmpwi r10, 0
bne .Louter_loop_0
ld r0, 16(r1) # restore saved link register
mtlr r0
addi r1, r1, 32 # destroy the stack frame
blr
#------------------------------------------------------------------------------
# Name: ReaderLODSD
# Purpose: Reads 32-bit values sequentially from an area of memory
# using LWZ instruction.
# Params: r3 = ptr to memory area
# r4 = length in bytes (inner loop count)
# r5 = loops (outer loop count)
#------------------------------------------------------------------------------
.align 2 # align to 4 byte boundary
ReaderLODSD:
_ReaderLODSD:
stdu r1, -32(r1) # update and store stack pointer
mflr r0 # set up the stack frame
std r0, 16(r1) # save the link register
mr r7, r4 # calculate inner loop count
srdi r7, r7, 2 # length in doublewords rounded down
mr r10, r5 # load outer loop counter
.Louter_loop_1:
addi r10, r10, -1
mtctr r7 # copy inner loop count to count register
mr r9, r3 # (re)load inner loop pointer address
.Linner_loop_1:
lwz r8, 0(r9)
addi r9, r9, 4 # increment pointer by 1 double word
bdnz .Linner_loop_1
cmpwi r10, 0
bne .Louter_loop_1
ld r0, 16(r1) # restore saved link register
mtlr r0
addi r1, r1, 32 # destroy the stack frame
blr
#------------------------------------------------------------------------------
# Name: ReaderLODSW
# Purpose: Reads 16-bit values sequentially from an area of memory
# using LHZ instruction.
# Params: r3 = ptr to memory area
# r4 = length in bytes (inner loop count)
# r5 = loops (outer loop count)
#------------------------------------------------------------------------------
.align 2 # align to 4 byte boundary
ReaderLODSW:
_ReaderLODSW:
stdu r1, -32(r1) # update and store stack pointer
mflr r0 # set up the stack frame
std r0, 16(r1) # save the link register
mr r7, r4 # calculate inner loop count
srdi r7, r7, 1 # length in words rounded down
mr r10, r5 # load outer loop counter
.Louter_loop_2:
addi r10, r10, -1
mtctr r7 # copy inner loop count to count register
mr r9, r3 # (re)load inner loop pointer address
.Linner_loop_2:
lhz r8, 0(r9)
addi r9, r9, 2 # increment pointer by 1 word
bdnz .Linner_loop_2
cmpwi r10, 0
bne .Louter_loop_2
ld r0, 16(r1) # restore saved link register
mtlr r0
addi r1, r1, 32 # destroy the stack frame
blr
#------------------------------------------------------------------------------
# Name: ReaderLODSB
# Purpose: Reads 16-bit values sequentially from an area of memory
# using LDBZ instruction.
# Params: r3 = ptr to memory area
# r4 = length in bytes (inner loop count)
# r5 = loops (outer loop count)
#------------------------------------------------------------------------------
.align 2 # align to 4 byte boundary
ReaderLODSB:
_ReaderLODSB:
stdu r1, -32(r1) # update and store stack pointer
mflr r0 # set up the stack frame
std r0, 16(r1) # save the link register
mr r10, r5 # load outer loop counter
.Louter_loop_3:
addi r10, r10, -1
mtctr r4 # copy inner loop count to count register
mr r9, r3 # (re)load inner loop pointer address
.Linner_loop_3:
lbz r8, 0(r9)
addi r9, r9, 1 # increment pointer by 1 byte
bdnz .Linner_loop_3
cmpwi r10, 0
bne .Louter_loop_3
ld r0, 16(r1) # restore saved link register
mtlr r0
addi r1, r1, 32 # destroy the stack frame
blr
#------------------------------------------------------------------------------
# Name: Reader
# Purpose: Reads 64-bit values sequentially from an area of memory.
# Params: r3 = ptr to memory area
# r4 = length in bytes
# r5 = loops
#------------------------------------------------------------------------------
.align 3 # align to 8 byte boundary
Reader:
_Reader:
stdu r1, -32(r1) # update and store stack pointer
mflr r0 # set up the stack frame
std r0, 16(r1) # save the link register
mr r7, r4 # calculate inner loop count
srdi r7, r7, 8 # length in bytes / 256
mr r10, r5 # load outer loop counter
.Louter_loop_4:
addi r10, r10, -1
mtctr r7 # copy inner loop count to count register
mr r9, r3 # (re)load inner loop pointer address
.Linner_loop_4:
ld r8, 0(r9)
ld r8, 8(r9)
ld r8, 16(r9)
ld r8, 24(r9)
ld r8, 32(r9)
ld r8, 40(r9)
ld r8, 48(r9)
ld r8, 56(r9)
ld r8, 64(r9)
ld r8, 72(r9)
ld r8, 80(r9)
ld r8, 88(r9)
ld r8, 96(r9)
ld r8, 104(r9)
ld r8, 112(r9)
ld r8, 120(r9)
ld r8, 128(r9)
ld r8, 136(r9)
ld r8, 144(r9)
ld r8, 152(r9)
ld r8, 160(r9)
ld r8, 168(r9)
ld r8, 176(r9)
ld r8, 184(r9)
ld r8, 192(r9)
ld r8, 200(r9)
ld r8, 208(r9)
ld r8, 216(r9)
ld r8, 224(r9)
ld r8, 232(r9)
ld r8, 240(r9)
ld r8, 248(r9)
addi r9, r9, 256 # increment pointer by 256 bytes
bdnz .Linner_loop_4
cmpwi r10, 0
bne .Louter_loop_4
ld r0, 16(r1) # restore saved link register
mtlr r0
addi r1, r1, 32 # destroy the stack frame
blr
#------------------------------------------------------------------------------
# Name: Reader_128bytes
# Purpose: Reads 64-bit values sequentially from an area of memory.
# Params: r3 = ptr to memory area
# r4 = length in bytes
# r5 = loops
#------------------------------------------------------------------------------
.align 3 # align to 8 byte boundary
Reader_128bytes:
_Reader_128bytes:
stdu r1, -32(r1) # update and store stack pointer
mflr r0 # set up the stack frame
std r0, 16(r1) # save the link register
mr r7, r4 # calculate inner loop count
srdi r7, r7, 7 # length in bytes / 128
mr r10, r5 # load outer loop counter
.Louter_loop_5:
addi r10, r10, -1
mtctr r7 # copy inner loop count to count register
mr r9, r3 # (re)load inner loop pointer address
.Linner_loop_5:
ld r8, 0(r9)
ld r8, 8(r9)
ld r8, 16(r9)
ld r8, 24(r9)
ld r8, 32(r9)
ld r8, 40(r9)
ld r8, 48(r9)
ld r8, 56(r9)
ld r8, 64(r9)
ld r8, 72(r9)
ld r8, 80(r9)
ld r8, 88(r9)
ld r8, 96(r9)
ld r8, 104(r9)
ld r8, 112(r9)
ld r8, 120(r9)
addi r9, r9, 128 # increment pointer by 128 bytes
bdnz .Linner_loop_5
cmpwi r10, 0
bne .Louter_loop_5
ld r0, 16(r1) # restore saved link register
mtlr r0
addi r1, r1, 32 # destroy the stack frame
blr
#------------------------------------------------------------------------------
# Name: RandomReaderVSX
# Purpose: Reads 128-bit values randomly from an area of memory.
# Params: r3 = ptr to array of chunk pointers
# r4 = # of chunks
# r5 = loops
#------------------------------------------------------------------------------
.align 3 # align to 8 byte boundary
RandomReaderVSX:
_RandomReaderVSX:
stdu r1, -152(r1) # update and store stack pointer
mflr r0 # set up the stack frame
std r0, 16(r1) # save the link register
std r14, 24(r1) # save r14
std r15, 32(r1) # save r15
std r16, 40(r1) # save r16
std r17, 48(r1) # save r17
std r18, 56(r1) # save r18
std r19, 64(r1) # save r19
std r20, 72(r1) # save r20
std r21, 80(r1) # save r21
std r22, 88(r1) # save r22
std r23, 96(r1) # save r23
std r24, 104(r1) # save r24
std r25, 112(r1) # save r25
std r26, 120(r1) # save r26
std r27, 128(r1) # save r27
std r28, 136(r1) # save r28
li r12, 240 # initialize read offset registers
li r14, 128
li r15, 64
li r16, 208
li r17, 112
li r18, 176
li r19, 144
li r20, 0
li r21, 96
li r22, 16
li r23, 192
li r24, 160
li r25, 32
li r26, 48
li r27, 224
li r28, 80
mr r10, r5 # load outer loop counter
.Louter_vsx_loop_0:
addi r10, r10, -1
mr r11, r4 # copy inner loop count to inner loop count register
.Linner_vsx_loop_0:
addi r11, r11, -1
mr r7, r11 # (re)calculate inner loop data offset
sldi r7, r7, 3
ldx r9, r3, r7 # (re)compute inner loop start pointer
lxvd2x v0, r12, r9
lxvd2x v0, r14, r9
lxvd2x v0, r15, r9
lxvd2x v0, r16, r9
lxvd2x v0, r17, r9
lxvd2x v0, r18, r9
lxvd2x v0, r19, r9
lxvd2x v0, r20, r9
lxvd2x v0, r21, r9
lxvd2x v0, r22, r9
lxvd2x v0, r23, r9
lxvd2x v0, r24, r9
lxvd2x v0, r25, r9
lxvd2x v0, r26, r9
lxvd2x v0, r27, r9
lxvd2x v0, r28, r9
cmpwi r11, 0
bne .Linner_vsx_loop_0
cmpwi r10, 0
bne .Louter_vsx_loop_0
ld r28, 136(r1) # restore r28
ld r27, 128(r1) # restore r27
ld r26, 120(r1) # restore r26
ld r25, 112(r1) # restore r25
ld r24, 104(r1) # restore r24
ld r23, 96(r1) # restore r23
ld r22, 88(r1) # restore r22
ld r21, 80(r1) # restore r21
ld r20, 72(r1) # restore r20
ld r19, 64(r1) # restore r19
ld r18, 56(r1) # restore r18
ld r17, 48(r1) # restore r17
ld r16, 40(r1) # restore r16
ld r15, 32(r1) # restore r15
ld r14, 24(r1) # restore r14
ld r0, 16(r1) # restore saved link register
mtlr r0
addi r1, r1, 152 # destroy the stack frame
blr
#------------------------------------------------------------------------------
# Name: ReaderVSX
# Purpose: Reads 128-bit values sequentially from an area of memory.
# Params: r3 = ptr to memory area
# r4 = length in bytes
# r5 = loops
#------------------------------------------------------------------------------
.align 3 # align to 8 byte boundary
ReaderVSX:
_ReaderVSX:
stdu r1, -144(r1) # update and store stack pointer
mflr r0 # set up the stack frame
std r0, 16(r1) # save the link register
std r14, 24(r1) # save r14
std r15, 32(r1) # save r15
std r16, 40(r1) # save r16
std r17, 48(r1) # save r17
std r18, 56(r1) # save r18
std r19, 64(r1) # save r19
std r20, 72(r1) # save r20
std r21, 80(r1) # save r21
std r22, 88(r1) # save r22
std r23, 96(r1) # save r23
std r24, 104(r1) # save r24
std r25, 112(r1) # save r25
std r26, 120(r1) # save r26
std r27, 128(r1) # save r27
mr r7, r4 # calculate inner loop count
srdi r7, r7, 8 # length in bytes / 256
li r11, 0 # initialize read offset registers
li r12, 16
li r14, 32
li r15, 48
li r16, 64
li r17, 80
li r18, 96
li r19, 112
li r20, 128
li r21, 144
li r22, 160
li r23, 176
li r24, 192
li r25, 208
li r26, 224
li r27, 240
mr r10, r5 # load outer loop counter
.Louter_vsx_loop_1:
addi r10, r10, -1
mtctr r7 # copy inner loop count to count register
mr r9, r3 # (re)load inner loop pointer address
.Linner_vsx_loop_1:
lxvd2x v0, r11, r9
lxvd2x v0, r12, r9
lxvd2x v0, r14, r9
lxvd2x v0, r15, r9
lxvd2x v0, r16, r9
lxvd2x v0, r17, r9
lxvd2x v0, r18, r9
lxvd2x v0, r19, r9
lxvd2x v0, r20, r9
lxvd2x v0, r21, r9
lxvd2x v0, r22, r9
lxvd2x v0, r23, r9
lxvd2x v0, r24, r9
lxvd2x v0, r25, r9
lxvd2x v0, r26, r9
lxvd2x v0, r27, r9
addi r9, r9, 256 # increment pointer by 256 bytes
bdnz .Linner_vsx_loop_1
cmpwi r10, 0
bne .Louter_vsx_loop_1
ld r27, 128(r1) # restore r27
ld r26, 120(r1) # restore r26
ld r25, 112(r1) # restore r25
ld r24, 104(r1) # restore r24
ld r23, 96(r1) # restore r23
ld r22, 88(r1) # restore r22
ld r21, 80(r1) # restore r21
ld r20, 72(r1) # restore r20
ld r19, 64(r1) # restore r19
ld r18, 56(r1) # restore r18
ld r17, 48(r1) # restore r17
ld r16, 40(r1) # restore r16
ld r15, 32(r1) # restore r15
ld r14, 24(r1) # restore r14
ld r0, 16(r1) # restore saved link register
mtlr r0
addi r1, r1, 144 # destroy the stack frame
blr
#------------------------------------------------------------------------------
# Name: RandomReader
# Purpose: Reads 64-bit values randomly from an area of memory.
# Params: r3 = ptr to array of chunk pointers
# r4 = # of chunks
# r5 = loops
#------------------------------------------------------------------------------
.align 3 # align to 8 byte boundary
RandomReader:
_RandomReader:
stdu r1, -32(r1) # update and store stack pointer
mflr r0 # set up the stack frame
std r0, 16(r1) # save the link register
mr r10, r5 # load outer loop counter
.Louter_loop_6:
addi r10, r10, -1
mr r11, r4 # copy inner loop count to inner loop count register
.Linner_loop_6:
addi r11, r11, -1
mr r7, r11 # (re)calculate inner loop data offset
sldi r7, r7, 3
ldx r9, r3, r7 # (re)compute inner loop start pointer
ld r8, 96(r9)
ld r8, 0(r9)
ld r8, 120(r9)
ld r8, 184(r9)
ld r8, 160(r9)
ld r8, 176(r9)
ld r8, 112(r9)
ld r8, 80(r9)
ld r8, 32(r9)
ld r8, 128(r9)
ld r8, 88(r9)
ld r8, 40(r9)
ld r8, 48(r9)
ld r8, 72(r9)
ld r8, 200(r9)
ld r8, 24(r9)
ld r8, 152(r9)
ld r8, 16(r9)
ld r8, 248(r9)
ld r8, 56(r9)
ld r8, 240(r9)
ld r8, 208(r9)
ld r8, 104(r9)
ld r8, 216(r9)
ld r8, 136(r9)
ld r8, 232(r9)
ld r8, 64(r9)
ld r8, 224(r9)
ld r8, 144(r9)
ld r8, 192(r9)
ld r8, 8(r9)
ld r8, 168(r9)
cmpwi r11, 0
bne .Linner_loop_6
cmpwi r10, 0
bne .Louter_loop_6
ld r0, 16(r1) # restore saved link register
mtlr r0
addi r1, r1, 32 # destroy the stack frame
blr
#------------------------------------------------------------------------------
# Name: RandomWriter
# Purpose: Writes 64-bit values randomly to an area of memory.
# Params: r3 = ptr to array of chunk pointers
# r4 = # of chunks
# r5 = loops
# r6 = datum to write
#------------------------------------------------------------------------------
.align 3 # align to 8 byte boundary
RandomWriter:
_RandomWriter:
stdu r1, -32(r1) # update and store stack pointer
mflr r0 # set up the stack frame
std r0, 16(r1) # save the link register
mr r10, r5 # load outer loop counter
.Louter_loop_7:
addi r10, r10, -1
mr r11, r4 # copy inner loop count to inner loop count register
.Linner_loop_7:
addi r11, r11, -1
mr r7, r11 # (re)calculate inner loop data offset
sldi r7, r7, 3
ldx r9, r3, r7 # (re)compute inner loop start pointer
std r8, 96(r9)
std r8, 0(r9)
std r8, 120(r9)
std r8, 184(r9)
std r8, 160(r9)
std r8, 176(r9)
std r8, 112(r9)
std r8, 80(r9)
std r8, 32(r9)
std r8, 128(r9)
std r8, 88(r9)
std r8, 40(r9)
std r8, 48(r9)
std r8, 72(r9)
std r8, 200(r9)
std r8, 24(r9)
std r8, 152(r9)
std r8, 16(r9)
std r8, 248(r9)
std r8, 56(r9)
std r8, 240(r9)
std r8, 208(r9)
std r8, 104(r9)
std r8, 216(r9)
std r8, 136(r9)
std r8, 232(r9)
std r8, 64(r9)
std r8, 224(r9)
std r8, 144(r9)
std r8, 192(r9)
std r8, 8(r9)
std r8, 168(r9)
cmpwi r11, 0
bne .Linner_loop_7
cmpwi r10, 0
bne .Louter_loop_7
ld r0, 16(r1) # restore saved link register
mtlr r0
addi r1, r1, 32 # destroy the stack frame
blr
#------------------------------------------------------------------------------
# Name: WriterVSX
# Purpose: Writes 128-bit value sequentially to an area of memory.
# Params: r3 = ptr to memory area
# r4 = length in bytes
# r5 = loops
# r6 = quad to write
#------------------------------------------------------------------------------
.align 3 # align to 8 byte boundary
WriterVSX:
_WriterVSX:
stdu r1, -144(r1) # update and store stack pointer
mflr r0 # set up the stack frame
std r0, 16(r1) # save the link register
std r14, 24(r1) # save r14
std r15, 32(r1) # save r15
std r16, 40(r1) # save r16
std r17, 48(r1) # save r17
std r18, 56(r1) # save r18
std r19, 64(r1) # save r19
std r20, 72(r1) # save r20
std r21, 80(r1) # save r21
std r22, 88(r1) # save r22
std r23, 96(r1) # save r23
std r24, 104(r1) # save r24
std r25, 112(r1) # save r25
std r26, 120(r1) # save r26
std r27, 128(r1) # save r27
mtvsrd vs1, r6 # load value to write into vector register
mr r7, r4 # calculate inner loop count
srdi r7, r7, 8 # length in bytes / 256
li r11, 0 # initialize write offset registers
li r12, 16
li r14, 32
li r15, 48
li r16, 64
li r17, 80
li r18, 96
li r19, 112
li r20, 128
li r21, 144
li r22, 160
li r23, 176
li r24, 192
li r25, 208
li r26, 224
li r27, 240
mr r10, r5 # load outer loop counter
.Louter_vsx_loop_2:
addi r10, r10, -1
mtctr r7 # copy inner loop count to count register
mr r9, r3 # (re)load inner loop pointer address
.Linner_vsx_loop_2:
stxvd2x v0, r11, r9
stxvd2x v0, r12, r9
stxvd2x v0, r14, r9
stxvd2x v0, r15, r9
stxvd2x v0, r16, r9
stxvd2x v0, r17, r9
stxvd2x v0, r18, r9
stxvd2x v0, r19, r9
stxvd2x v0, r20, r9
stxvd2x v0, r21, r9
stxvd2x v0, r22, r9
stxvd2x v0, r23, r9
stxvd2x v0, r24, r9
stxvd2x v0, r25, r9
stxvd2x v0, r26, r9
stxvd2x v0, r27, r9
addi r9, r9, 256 # increment pointer by 256 bytes
bdnz .Linner_vsx_loop_2
cmpwi r10, 0
bne .Louter_vsx_loop_2
ld r27, 128(r1) # restore r27
ld r26, 120(r1) # restore r26
ld r25, 112(r1) # restore r25
ld r24, 104(r1) # restore r24
ld r23, 96(r1) # restore r23
ld r22, 88(r1) # restore r22
ld r21, 80(r1) # restore r21
ld r20, 72(r1) # restore r20
ld r19, 64(r1) # restore r19
ld r18, 56(r1) # restore r18
ld r17, 48(r1) # restore r17
ld r16, 40(r1) # restore r16
ld r15, 32(r1) # restore r15
ld r14, 24(r1) # restore r14
ld r0, 16(r1) # restore saved link register
mtlr r0
addi r1, r1, 144 # destroy the stack frame
blr
#------------------------------------------------------------------------------
# Name: RandomWriterVSX
# Purpose: Writes 128-bit values randomly to an area of memory.
# Params: r3 = ptr to memory area
# r4 = length in bytes
# r5 = loops
# r6 = quad to write
#------------------------------------------------------------------------------
.align 3 # align to 8 byte boundary
RandomWriterVSX:
_RandomWriterVSX:
stdu r1, -152(r1) # update and store stack pointer
mflr r0 # set up the stack frame
std r0, 16(r1) # save the link register
std r14, 24(r1) # save r14
std r15, 32(r1) # save r15
std r16, 40(r1) # save r16
std r17, 48(r1) # save r17
std r18, 56(r1) # save r18
std r19, 64(r1) # save r19
std r20, 72(r1) # save r20
std r21, 80(r1) # save r21
std r22, 88(r1) # save r22
std r23, 96(r1) # save r23
std r24, 104(r1) # save r24
std r25, 112(r1) # save r25
std r26, 120(r1) # save r26
std r27, 128(r1) # save r27
std r28, 136(r1) # save r28
mtvsrd vs1, r6 # load value to write into vector register
li r12, 240 # initialize write offset registers
li r14, 128
li r15, 64
li r16, 208
li r17, 112
li r18, 176
li r19, 144
li r20, 0
li r21, 96
li r22, 16
li r23, 192
li r24, 160
li r25, 32
li r26, 48
li r27, 224
li r28, 80
mr r10, r5 # load outer loop counter
.Louter_vsx_loop_3:
addi r10, r10, -1
mr r11, r4 # copy inner loop count to inner loop count register
.Linner_vsx_loop_3:
addi r11, r11, -1
mr r7, r11 # (re)calculate inner loop data offset
sldi r7, r7, 3
ldx r9, r3, r7 # (re)compute inner loop start pointer
stxvd2x v0, r12, r9
stxvd2x v0, r14, r9
stxvd2x v0, r15, r9
stxvd2x v0, r16, r9
stxvd2x v0, r17, r9
stxvd2x v0, r18, r9
stxvd2x v0, r19, r9
stxvd2x v0, r20, r9
stxvd2x v0, r21, r9
stxvd2x v0, r22, r9
stxvd2x v0, r23, r9
stxvd2x v0, r24, r9
stxvd2x v0, r25, r9
stxvd2x v0, r26, r9
stxvd2x v0, r27, r9
stxvd2x v0, r28, r9
cmpwi r11, 0
bne .Linner_vsx_loop_3
cmpwi r10, 0
bne .Louter_vsx_loop_3
ld r28, 136(r1) # restore r28
ld r27, 128(r1) # restore r27
ld r26, 120(r1) # restore r26
ld r25, 112(r1) # restore r25
ld r24, 104(r1) # restore r24
ld r23, 96(r1) # restore r23
ld r22, 88(r1) # restore r22
ld r21, 80(r1) # restore r21
ld r20, 72(r1) # restore r20
ld r19, 64(r1) # restore r19
ld r18, 56(r1) # restore r18
ld r17, 48(r1) # restore r17
ld r16, 40(r1) # restore r16
ld r15, 32(r1) # restore r15
ld r14, 24(r1) # restore r14
ld r0, 16(r1) # restore saved link register
mtlr r0
addi r1, r1, 152 # destroy the stack frame
blr
#------------------------------------------------------------------------------
# Name: Writer
# Purpose: Writes 64-bit value sequentially to an area of memory.
# Params: r3 = ptr to memory area
# r4 = length in bytes
# r5 = loops
# r6 = quad to write
#------------------------------------------------------------------------------
.align 3 # align to 8 byte boundary
Writer:
_Writer:
stdu r1, -32(r1) # update and store stack pointer
mflr r0 # set up the stack frame
std r0, 16(r1) # save the link register
mr r7, r4 # calculate inner loop count
srdi r7, r7, 8 # length in bytes / 256
mr r10, r5 # load outer loop counter
.Louter_loop_8:
addi r10, r10, -1
mtctr r7 # copy inner loop count to count register
mr r9, r3 # (re)load inner loop pointer address
.Linner_loop_8:
std r6, 0(r9)
std r6, 8(r9)
std r6, 16(r9)
std r6, 24(r9)
std r6, 32(r9)
std r6, 40(r9)
std r6, 48(r9)
std r6, 56(r9)
std r6, 64(r9)
std r6, 72(r9)
std r6, 80(r9)
std r6, 88(r9)
std r6, 96(r9)
std r6, 104(r9)
std r6, 112(r9)
std r6, 120(r9)
std r6, 128(r9)
std r6, 136(r9)
std r6, 144(r9)
std r6, 152(r9)
std r6, 160(r9)
std r6, 168(r9)
std r6, 176(r9)
std r6, 184(r9)
std r6, 192(r9)
std r6, 200(r9)
std r6, 208(r9)
std r6, 216(r9)
std r6, 224(r9)
std r6, 232(r9)
std r6, 240(r9)
std r6, 248(r9)
addi r9, r9, 256 # increment pointer by 256 bytes
bdnz .Linner_loop_8
cmpwi r10, 0
bne .Louter_loop_8
ld r0, 16(r1) # restore saved link register
mtlr r0
addi r1, r1, 32 # destroy the stack frame
blr
#------------------------------------------------------------------------------
# Name: Writer_128bytes
# Purpose: Writes 64-bit value sequentially to an area of memory.
# Params: r3 = ptr to memory area
# r4 = length in bytes
# r5 = loops
# r6 = quad to write
#------------------------------------------------------------------------------
.align 3 # align to 8 byte boundary
Writer_128bytes:
_Writer_128bytes:
stdu r1, -32(r1) # update and store stack pointer
mflr r0 # set up the stack frame
std r0, 16(r1) # save the link register
mr r7, r4 # calculate inner loop count
srdi r7, r7, 7 # length in bytes / 128
mr r10, r5 # load outer loop counter
.Louter_loop_9:
addi r10, r10, -1
mtctr r7 # copy inner loop count to count register
mr r9, r3 # (re)load inner loop pointer address
.Linner_loop_9:
std r6, 0(r9)
std r6, 8(r9)
std r6, 16(r9)
std r6, 24(r9)
std r6, 32(r9)
std r6, 40(r9)
std r6, 48(r9)
std r6, 56(r9)
std r6, 64(r9)
std r6, 72(r9)
std r6, 80(r9)
std r6, 88(r9)
std r6, 96(r9)
std r6, 104(r9)
std r6, 112(r9)
std r6, 120(r9)
addi r9, r9, 128 # increment pointer by 128 bytes
bdnz .Linner_loop_9
cmpwi r10, 0
bne .Louter_loop_9
ld r0, 16(r1) # restore saved link register
mtlr r0
addi r1, r1, 32 # destroy the stack frame