I have this issorted code to sort elements of an array. It's very slow as it is right now due to a lot of memory access, number of branch instructions per iteration of the poorly written loops, and unorganized instruction/register usage causing dependencies between instructions. I'm not sure on how to go about improving my code to be faster and efficient. I need a nudge in the right direction as I'm new to assembly.
.globl issorted
.align 4, 0x90
issorted:
movl $1, %eax
.align 4, 0x90
LBB1_1:
cmpq %rsi, %rax
jge LBB1_4
movq (%rdi,%rax,8), %rcx
leaq 1(%rax), %rdx
cmpq %rcx, -8(%rdi,%rax,8)
movq %rdx, %rax
jle LBB1_1
xorl %eax, %eax
ret
LBB1_4:
movl $1, %eax
ret