Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .text
- .global dot_product
- dot_product:
- push %ebp
- mov %esp, %ebp
- push %ebx
- mov 8(%ebp), %eax
- mov 12(%ebp), %ebx
- mov 16(%ebp), %edx
- movss $0, %xmm2
- cmpl $4, %eax
- jge more_than_four
- last_point:
- testl %eax, %eax
- je is_zero
- movss (%ebx), %xmm0
- movss (%edx), %xmm1
- mulss %xmm0, %xmm1
- addss %xmm1, %xmm2
- addl $4, %edx
- addl $4, %ebx
- decl %eax
- jmp last_point
- more_than_four:
- movupd (%ebx), %xmm0
- movupd (%edx), %xmm1
- mulps %xmm1, %xmm0
- movss $0, %xmm1
- subl $16, %esp
- movupd %xmm0, %esp
- addss (%esp), %xmm2
- addss 4(%esp), %xmm2
- addss 8(%esp), %xmm2
- addss 12(%esp), %xmm2
- addl $16, %esp
- addl $16, %ebx
- addl $16, %edx
- subl $4, %eax
- cmpl $4, %eax
- jl last_point
- jmp more_than_four
- is_zero:
- movss %xmm2, %xmm0
- subl $4, %esp
- movss %xmm0, (%esp)
- flds (%esp)
- addl $4, %esp
- popl %ebx
- movl %ebp, %esp
- popl %ebp
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement