Advertisement
tartakynov

get division remainder of two 64-bit real numbers

Jan 29th, 2012
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; this code gets division remainder of two 64-bit real numbers (DP-FP) using SSE2 instruction set
  2. ; it's very slow I know
  3. movsd xmm0, vl      ; copy left operand to xmm0
  4. movsd xmm1, vr      ; copy right operand to xmm1
  5. movsd xmm2, 0x7FFFFFFFFFFFFFFF
  6. movsd xmm3, 0x8000000000000000
  7. andpd xmm3, xmm0    ; remember the sign of left operand
  8. andpd xmm0, xmm2    ; get abs value of left operand
  9. andpd xmm1, xmm2    ; get abs value of right operand
  10. start:
  11. comisd xmm0, xmm1
  12. jc end
  13. subsd xmm0, xmm1
  14. jmp start
  15. orpd xmm0, xmm3     ; restore the sign of left operand
  16. end:
  17. mov [rdx], xmm0
  18. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement