summaryrefslogtreecommitdiff
path: root/source/files/assembly/x86
diff options
context:
space:
mode:
Diffstat (limited to 'source/files/assembly/x86')
-rw-r--r--source/files/assembly/x86/perf/array.asm33
-rw-r--r--source/files/assembly/x86/perf/array_faster.asm27
-rw-r--r--source/files/assembly/x86/perf/array_fastest.asm38
3 files changed, 98 insertions, 0 deletions
diff --git a/source/files/assembly/x86/perf/array.asm b/source/files/assembly/x86/perf/array.asm
new file mode 100644
index 0000000..8ffab7c
--- /dev/null
+++ b/source/files/assembly/x86/perf/array.asm
@@ -0,0 +1,33 @@
+section .text
+global _start:
+ call do_work
+ mov rax, 60
+ mov rdi, r13
+ syscall
+
+do_work:
+ mov r14, arrrrrr
+ xor r15, r15
+ xor r13, r13
+ jmp tst
+ nop
+lp:
+ movsxd rax, r15d
+ lea rax, [r14 + rax + 0x8]
+ movsx rax, byte [rax]
+ mov byte [rsp + 0x18], al
+ movzx rcx, al
+ and ecx, 0xf
+ mov rax, r13
+ add eax, ecx
+ inc r15
+ mov r13, rax
+tst:
+ movsxd rax, dword [r14]
+ cmp r15, rax
+ jl lp
+ ret
+
+arrrrrr:
+ dd 134217728
+ times 134217728 db 57h
diff --git a/source/files/assembly/x86/perf/array_faster.asm b/source/files/assembly/x86/perf/array_faster.asm
new file mode 100644
index 0000000..969bc54
--- /dev/null
+++ b/source/files/assembly/x86/perf/array_faster.asm
@@ -0,0 +1,27 @@
+section .text
+global _start:
+ call do_work
+ mov rax, 60
+ mov rdi, r13
+ syscall
+
+do_work:
+ mov r14, arrrrrr
+ xor r15, r15
+ xor r13, r13
+ movsxd rax, dword [r14]
+ jmp tst
+ nop
+lp:
+ mov cl, byte [r14 + r15 + 0x8]
+ and cl, 0xf
+ add r13, rcx
+ inc r15
+tst:
+ cmp r15, rax
+ jl lp
+ ret
+
+arrrrrr:
+ dd 134217728
+ times 134217728 db 57h
diff --git a/source/files/assembly/x86/perf/array_fastest.asm b/source/files/assembly/x86/perf/array_fastest.asm
new file mode 100644
index 0000000..2e91562
--- /dev/null
+++ b/source/files/assembly/x86/perf/array_fastest.asm
@@ -0,0 +1,38 @@
+section .text
+global _start:
+ call do_work
+ mov rax, 60
+ mov rdi, r13
+ syscall
+
+do_work:
+ mov r14, arrrrrr
+ xor r15, r15
+ xor r13, r13
+ mov rcx, 0x0f0f0f0f
+ rcl rcx, 32
+ or rcx, 0x0f0f0f0f
+ mov rax, 0
+ movq mm1, rax
+
+ mov ebx, dword [r14]
+ lea rsi, [r14 + 0x8]
+ test rbx, rbx
+ jmp tst
+ nop
+lp:
+ lodsq
+ and rax, rcx
+ movq mm0, rax
+ psadbw mm0, mm1
+ movq rax, mm0
+ add r13, rax
+
+ sub rbx, 8
+tst:
+ jnz lp
+ ret
+
+arrrrrr:
+ dd 134217728
+ times 134217728 db 57h