forked from travisdowns/uarch-bench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
x86-methods.asm
3261 lines (2772 loc) · 54.9 KB
/
x86-methods.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
%include "x86-helpers.asm"
nasm_util_assert_boilerplate
thunk_boilerplate
; a variant of define_bench that puts a "touch" function immediately following
; the
%macro make_touch 0
%ifndef current_bench
%error "current_bench must be defined for this to work"
%endif
GLOBAL current_bench %+ _touch:function
current_bench %+ _touch:
ret
%endmacro
;; This function executes a tight loop, where we expect that each iteration takes
;; once cycle (plus some penalty on loop exit due to the mispredict). We time this
;; function to calculate the effective CPU frequency. We could also consider a series
;; of dependent add calls, which we expect to each take 1 cycle as well. It isn't
;; really clear which assumption is the most likely to be true in the future, but
;; most delay loops seem to be of the "tight loop" variety, so let's choose that.
;; In the past, both of these approaches would have returned wrong values, e.g.,
;; twice the true frequency for the "add" approach on the double-pumped ALU on the P4
;; or half or less than the true frequency on CPUs that can't issue one taken branch
;; per cycle.
GLOBAL add_calibration_x86:function
ALIGN 32
add_calibration_x86:
mov rax, -1
neg rax ; on some CPUs, subtractions of a constant can somehow be optimized
; to run > 1 per cycle even if dependent, so we use a reg op
; operand instead
times 2 sub rdi, rax
jge add_calibration_x86
ret
define_bench dummy_bench_oneshot1
ret
define_bench dummy_bench_oneshot2
ret
make_touch
define_bench dep_add_noloop_128
xor eax, eax
times 128 add rax, rax
ret
define_bench dep_add_rax_rax
xor eax, eax
.top:
times 128 add rax, rax
dec rdi
jnz .top
ret
; just like the calibration routine
define_bench dep_sub_calib
xor eax, eax
.top:
times 2 sub rdi, 1
jge .top
ret
define_bench dep_sub_calib_10
xor eax, eax
.top:
times 10 sub rdi, 1
jge .top
ret
define_bench dep_sub_calib_reg
mov eax, 1
.top:
times 2 sub rdi, rax
jge .top
ret
define_bench dep_sub_calib_nop
mov eax, 1
.top:
sub rdi, 1
nop
sub rdi, 1
nop
jge .top
ret
define_bench dep_sub_calib_10b
mov rsi, -1
.top:
times 10 sub rsi, 1
sub rdi, 10
jge .top
ret
define_bench dep_sub_calib_v1000
mov rsi, -1
.top:
times 10 sub rsi, 1000
sub rdi, 10
jge .top
ret
define_bench dep_sub_calib_v100
mov rsi, -1
.top:
times 10 sub rsi, 100
sub rdi, 10
jge .top
ret
define_bench dep_sub_calib_v2
mov rsi, -1
.top:
times 10 sub rsi, 2
sub rdi, 10
jge .top
ret
define_bench dep_sub_calib_v1
mov rsi, -1
.top:
times 10 sub rsi, 1
sub rdi, 10
jge .top
ret
%macro define_dep_add_chain 1
define_bench dep_add_chain%1
%if %1 > 5
%error chain too big
%endif
push rbx
xor eax, eax
.top:
%rep 16
add eax, 1
%if %1 > 1
add ebx, 1
%endif
%if %1 > 2
add ecx, 1
%endif
%if %1 > 3
add edx, 1
%endif
%if %1 > 4
add rsi, 1
%endif
%endrep
dec rdi
jnz .top
pop rbx
ret
%endmacro
define_dep_add_chain 1
define_dep_add_chain 2
define_dep_add_chain 3
define_dep_add_chain 4
define_dep_add_chain 5
define_bench dep_imul128_rax
xor eax, eax
.top:
times 128 imul rax
dec rdi
jnz .top
ret
; because the 64x64=128 imul uses an implicit destination & first source
; we need to clear out eax each iteration to make it independent, although
; of course that may bias the measurement on some architectures
define_bench indep_imul128_rax
.top:
%rep 128
xor eax, eax
imul rax
%endrep
dec rdi
jnz .top
ret
define_bench dep_imul64_rax
xor eax, eax
.top:
times 128 imul rax, rax
dec rdi
jnz .top
ret
define_bench indep_imul64_rax
.top:
%rep 128
xor eax, eax
imul rax, rax
%endrep
dec rdi
jnz .top
ret
define_bench dep_pushpop
xor eax, eax
xor ecx, ecx
.top:
%rep 128
push rax
pop rax
%endrep
dec rdi
jnz .top
ret
define_bench indep_pushpop
xor eax, eax
xor ecx, ecx
.top:
%rep 128
push rax
pop rcx
%endrep
dec rdi
jnz .top
ret
define_bench div_64_64
xor eax,eax
xor edx,edx
mov ecx, 1
.top:
times 128 div rcx
dec rdi
jnz .top
ret
define_bench idiv_64_64
xor eax,eax
xor edx,edx
mov ecx, 1
.top:
times 128 idiv rcx
dec rdi
jnz .top
ret
define_bench nop1_128
.top:
times 128 nop
dec rdi
jnz .top
ret
define_bench nop2_128
.top:
times 128 nop2
dec rdi
jnz .top
ret
define_bench xor_eax_128
.top:
times 128 xor eax, eax
dec rdi
jnz .top
ret
%if 1
%macro define_alu_load 1
define_bench alu_load_6_%1
push_callee_saved
.top:
%rep 64
add eax, 1
add ebx, 1
add ecx, 1
add edx, 1
add esi, 1
add ebp, 1
%assign rnum 8
%rep %1
mov r %+ rnum, [rsp + (rnum - 8) * 4]
%assign rnum (rnum + 1)
%endrep
%undef rnum
%endrep
dec rdi
jnz .top
pop_callee_saved
ret
%endmacro
define_alu_load 0
define_alu_load 1
define_alu_load 2
define_alu_load 3
define_alu_load 4
define_alu_load 5
define_alu_load 6
%endif
empty_fn:
ret
define_bench dense_calls
.top:
%rep 16
call empty_fn
;nop
%endrep
dec rdi
jnz .top
ret
%macro sparse_calls 1
define_bench sparse %+ %1 %+ _calls
xor eax, eax
.top:
%rep 16
call empty_fn
times %1 add eax, 1
%endrep
dec rdi
jnz .top
ret
%endmacro
sparse_calls 0
sparse_calls 1
sparse_calls 2
sparse_calls 3
sparse_calls 4
sparse_calls 5
sparse_calls 6
sparse_calls 7
%macro chained_calls 1
define_bench chained %+ %1 %+ _calls
xor eax, eax
.top:
%rep 4
call call_chain_3
times %1 add eax, 1
%endrep
dec rdi
jnz .top
ret
%endmacro
chained_calls 0
chained_calls 1
chained_calls 2
chained_calls 3
pushpop:
push rax
pop rax
ret
define_bench pushpop_calls
xor eax, eax
.top:
%rep 16
call pushpop
%endrep
dec rdi
jnz .top
ret
%macro addrsp 1
addrsp%1:
add QWORD [rax - %1], 0
add QWORD [rax - %1], 0
ret
%endmacro
%macro addrsp_calls 1
addrsp %1
define_bench addrsp%1_calls
lea rax, [rsp - 8]
.top:
%rep 16
call addrsp%1
%endrep
dec rdi
jnz .top
ret
%endmacro
addrsp_calls 0
addrsp_calls 8
define_bench indep_add
.top:
%rep 50
add eax, ebp
add ecx, ebp
add edx, ebp
add esi, ebp
add r8d, ebp
add r9d, ebp
add r10d, ebp
add r11d, ebp
%endrep
dec rdi
jnz .top
ret
; a basic bench that repeats a single op the given number
; of times, defaults to 128
; %1 the benchmark name
; %2 the full operation
; %3 the default of repeates (128 if not specified)
%macro define_single_op 2-3 128
define_bench %1
xor eax, eax
.top:
times %3 %2
dec rdi
jnz .top
ret
%endmacro
define_single_op rdtsc_bench,rdtsc
define_single_op rdtscp_bench,rdtscp
; pointer chasing loads from a single stack location on the stack
; %1 name suffix
; %2 load expression (don't include [])
; %3 offset if any to apply to pointer and load expression
%macro make_spc 4
define_bench sameloc_pointer_chase%1
push rbp
mov rbp, rsp
sub rsp, 8192
and rsp, -4096 ; align rsp to page boundary
or rcx, -1
inc rcx ; rcx is zero but this is just a fancy way of doing it to defeat zero-idiom recognition
mov rax, rsp
%4
mov [%2 + %3], rax
mfence ; defeat memory renaming
.top:
times 128 mov rax, [%2 + %3]
dec rdi
jnz .top
mov rsp, rbp
pop rbp
ret
%endmacro
make_spc ,rax,0,{}
make_spc _2047,rax,2047,{}
make_spc _2048,rax,2048,{}
make_spc _complex,rax + rcx * 8,4096,{}
make_spc _fs,fs:rax,0,{sub rax, [fs:0]}
make_spc _complex_fs,fs:rax + rcx * 8,4096,{sub rax, [fs:0]}
; https://stackoverflow.com/q/52351397
define_bench sameloc_pointer_chase_diffpage
push rbp
mov rbp, rsp
sub rsp, 4096
and rsp, -4096 ; align rsp to page boundary
lea rax, [rsp - 8]
mov [rax + 16], rax
mfence ; defeat memory renaming
.top:
times 128 mov rax, [rax + 16]
dec rdi
jnz .top
mov rsp, rbp
pop rbp
ret
; https://stackoverflow.com/q/52351397
define_bench sameloc_pointer_chase_alt
push rbp
mov rbp, rsp
sub rsp, 4096
and rsp, -4096 ; align rsp to page boundary
lea rax, [rsp - 8]
mov [rax], rax
mov [rax + 16], rax
mfence ; defeat memory renaming
.top:
%rep 64
mov rax, [rax]
mov rax, [rax + 16]
%endrep
dec rdi
jnz .top
mov rsp, rbp
pop rbp
ret
; put an ALU op in the pointer chase path
define_bench sameloc_pointer_chase_alu
lea rax, [rsp - 8]
push rax
mfence ; defeat memory renaming
.top:
%rep 128
mov rax, [rax]
add rax, 0
%endrep
dec rdi
jnz .top
pop rax
ret
; put an ALU op in the pointer chase path
define_bench sameloc_pointer_chase_alu2
push rbp
mov rbp, rsp
and rsp, -4096 ; page align rsp to avoid inadvertent page crossing
sub rsp, 2048 + 4096
and rcx, 0 ; avoid zero idiom detection
lea rax, [rsp - 8]
push rax
mov [rax + 2048], rax
mfence ; defeat memory renaming
.top:
%rep 128
mov rax, [rax + 2048]
mov rax, [rax]
add rax, 0
%endrep
dec rdi
jnz .top
mov rsp, rbp
pop rbp
ret
; put an ALU op in the pointer chase path
define_bench sameloc_pointer_chase_alu3
push rbp
mov rbp, rsp
and rsp, -4096 ; page align rsp to avoid inadvertent page crossing
sub rsp, 2048 + 4096
and rcx, 0 ; avoid zero idiom detection
lea rax, [rsp - 8]
push rax
mov [rax + 2048], rax
mfence ; defeat memory renaming
.top:
%rep 128
mov rax, [rax + 2048]
add rax, 0
mov rax, [rax]
%endrep
dec rdi
jnz .top
mov rsp, rbp
pop rbp
ret
; do 8 parallel pointer chases to see if fast path (4-cycle) loads
; have a throughput restriction (e.g., only 1 per cycle)
define_bench sameloc_pointer_chase_8way
push rbp
mov rbp, rsp
and rsp, -4096 ; page align rsp to avoid inadvertent page crossing
push r12
push r13
push r14
push r15
%assign regn 8
%rep 8
%define reg r %+ regn
lea reg, [rsp - 8]
push reg
%assign regn (regn + 1)
%endrep
mfence ; defeat memory renaming
.top:
%rep 16
%assign regn 8
%rep 8
%define reg r %+ regn
mov reg, [reg]
%assign regn (regn + 1)
%endrep
%endrep
dec rdi
jnz .top
add rsp, 8 * 8
pop r15
pop r14
pop r13
pop r12
mov rsp, rbp
pop rbp
ret
; so we can treat r6 to r15 as a contiguous range
%define r6 rsi
%define r7 rdi
; do 10 parallel pointer chases to see if slow path (5-cycle) loads
; have a throughput restriction (e.g., only 1 per cycle)
define_bench sameloc_pointer_chase_8way5
push rbp
mov rbp, rsp
sub rsp, 8192
and rsp, -4096 ; page align rsp to avoid inadvertent page crossing
push r12
push r13
push r14
push r15
mov rcx, rdi ; because we need rdi and rsi as r6 and r7 with altreg
%define offset 4096
%assign regn 6
%rep 10
%define reg r %+ regn
lea reg, [rsp - 8 - offset]
push reg
%assign regn (regn + 1)
%endrep
mfence ; defeat memory renaming
.top:
%rep 16
%assign regn 6
%rep 10
%define reg r %+ regn
mov reg, [reg + offset]
%assign regn (regn + 1)
%endrep
%endrep
dec rcx
jnz .top
add rsp, 10 * 8
pop r15
pop r14
pop r13
pop r12
mov rsp, rbp
pop rbp
ret
; do 10 parallel pointer chases, unrolled 10 times, where 9 out of the 10
; accesses on each change are 5-cycle and one is 4-cycle, to see if mixing
; 4 and 5-cycle operations slows things down
define_bench sameloc_pointer_chase_8way45
push rbp
mov rbp, rsp
sub rsp, 8192
and rsp, -8192 ; page align rsp to avoid inadvertent page crossing
push r12
push r13
push r14
push r15
mov rcx, rdi
%define offset 4096
%define regcnt 10
%assign regn (16 - regcnt)
%rep regcnt
%define reg r %+ regn
lea reg, [rsp - 8]
push reg
mov [reg + offset], reg
%assign regn (regn + 1)
%endrep
mfence ; defeat memory renaming
.top:
%assign itr 0
%rep 10
%assign regn (16 - regcnt)
%rep regcnt
%define reg r %+ regn
%if (itr == (regn - (16 - regcnt)))
mov reg, [reg]
%else
mov reg, [reg + offset]
%endif
%assign regn (regn + 1)
%endrep
%assign itr (itr + 1)
%endrep
dec rcx
jnz .top
add rsp, regcnt * 8
pop r15
pop r14
pop r13
pop r12
mov rsp, rbp
pop rbp
ret
; repeated inc [eax]
define_bench inc_rmw
xor eax, eax
.top:
times 128 inc DWORD [rsp - 4]
dec rdi
jnz .top
ret
; repeated add [eax], 1
define_bench add_rmw
xor eax, eax
.top:
times 128 add DWORD [rsp - 4], 1
dec rdi
jnz .top
ret
; repeated add [eax], 1
define_bench add_rmw2
xor eax, eax
.top:
%rep 16
add DWORD [rsp + rax - 4], 1
times 4 lea rcx, [rcx + 0]
;add DWORD [rsp - 8], 1
;add DWORD [rsp - 12], 1
;add DWORD [rsp - 16], 1
;add DWORD [rsp - 20], 1
%endrep
dec rdi
jnz .top
ret
align 64
totally_empty:
ret
; repeated empty calls
define_bench call_empty
xor eax, eax
.top:
times 16 call totally_empty
dec rdi
jnz .top
ret
; a series of stores to the same location
define_bench store_same_loc
xor eax, eax
.top:
times 128 mov [rsp - 8], eax
dec rdi
jnz .top
ret
; a series of 16-bit stores to the same location, passed as the second parameter
define_bench store16_any
xor eax, eax
.top:
times 128 mov [rsi], ax
dec rdi
jnz .top
ret
; a series of 32-bit stores to the same location, passed as the second parameter
define_bench store32_any
xor eax, eax
.top:
times 128 mov [rsi], eax
dec rdi
jnz .top
ret
; a series of 64-bit stores to the same location, passed as the second parameter
define_bench store64_any
xor eax, eax
.top:
times 128 mov [rsi], rax
dec rdi
jnz .top
ret
; a series of AVX (REX-encoded) 128-bit stores to the same location, passed as the second parameter
define_bench store128_any
vpxor xmm0, xmm0, xmm0
.top:
times 128 vmovdqu [rsi], xmm0
dec rdi
jnz .top
ret
; a series of AVX (REX-encoded) 256-bit stores to the same location, passed as the second parameter
define_bench store256_any
vpxor xmm0, xmm0, xmm0
.top:
times 128 vmovdqu [rsi], ymm0
dec rdi
jnz .top
ret
; a series of AVX512 512-bit stores to the same location, passed as the second parameter
define_bench store512_any
vpxorq zmm16, zmm16, zmm16
.top:
times 128 vmovdqu64 [rsi], zmm16
dec rdi
jnz .top
ret
; a series of independent 16-bit loads from the same location, with location passed as the second parameter
; note that the loads are not zero-extended, so they only write the lower 16 bits of eax, and so on some
; implementations each load is actually dependent on the previous load (to merge in the upper bits of eax)
define_bench load16_any
xor eax, eax
.top:
times 128 mov ax, [rsi]
dec rdi
jnz .top
ret
; a series of independent 32-bit loads from the same location, with location passed as the second parameter
define_bench load32_any
.top:
times 128 mov eax, [rsi]
dec rdi
jnz .top
ret
; a series of independent 64-bit loads from the same location, with location passed as the second parameter
define_bench load64_any
.top:
times 128 mov rax, [rsi]
dec rdi
jnz .top
ret
; a series of independent 128-bit loads from the same location, with location passed as the second parameter
define_bench load128_any
.top:
times 128 vmovdqu xmm0, [rsi]
dec rdi
jnz .top
ret
; a series of independent 256-bit loads from the same location, with location passed as the second parameter
define_bench load256_any
.top:
%rep 64
vmovdqu ymm0, [rsi]
vmovdqu ymm1, [rsi]
%endrep
dec rdi
jnz .top
ret
; a series of independent 256-bit loads from the same location, with location passed as the second parameter
define_bench load512_any
.top:
%rep 64
vmovdqu64 zmm16, [rsi]
vmovdqu64 zmm16, [rsi]
%endrep
dec rdi
jnz .top
ret
; a series of stores to increasing locations without overlap, 1024 total touched
define_bench store64_disjoint
xor eax, eax
sub rsp, 1024
.top:
%assign offset 0
%rep 128
mov [rsp + offset], rax
%assign offset offset+8
%endrep
dec rdi
jnz .top
add rsp, 1024
ret
; Weird case where 32-bit add with memory source runs faster than 64-bit version
; Search for "Totally bizarre" in https://www.agner.org/optimize/blog/read.php?i=423
define_bench misc_add_loop32
push rbp
mov rbp, rsp
push rbx
mov rcx, rdi
sub rsp, 256
and rsp, -64
lea rax, [rsp + 64]
lea rdi, [rsp + 128]
jmp .top
ALIGN 32
.top:
add edx, [rsp]
mov [rax], edi
blsi ebx, [rdi]
dec ecx
jnz .top
; cleanup
mov rbx, [rbp - 8]
mov rsp, rbp
pop rbp
ret
define_bench misc_add_loop64
push rbp
mov rbp, rsp
push rbx
mov rcx, rdi
sub rsp, 256
and rsp, -64
lea rax, [rsp + 64]
lea rdi, [rsp + 128]
; oddly, the slowdown goes away when you do a 256-bit AVX op, like
; the ymm vpxor below, but not for xmm (at least with vzeroupper)
;vpxor ymm0, ymm0, ymm0
;vzeroupper
;vpxor xmm0, xmm0, xmm0
jmp .top
ALIGN 32
.top:
add rdx, [rsp]
mov [rax], rdi
blsi rbx, [rdi]
dec ecx
jnz .top
; cleanup
mov rbx, [rbp - 8]
mov rsp, rbp
pop rbp
ret
define_bench misc_port7
mov rax, rsp
mov rsi, [rsp]
xor edx, edx
.top:
mov ecx, [rax]
mov ecx, [rax]
mov [rax + rdx * 8], rsi
dec rdi
jnz .top
ret
define_bench misc_fusion_add
xor eax, eax