cvtps2pi.asm 749 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. global _start
  2. section .data
  3. align 16
  4. float0low:
  5. dd 12345.678
  6. float0high:
  7. dd 1234.5
  8. float1low:
  9. dd 0x80000001.0
  10. float1high:
  11. dd -2147483130.0
  12. mxcsr:
  13. dd 0
  14. ; Set mxcsr regiter rouding bits
  15. %macro setRoundingBits 1
  16. stmxcsr [mxcsr]
  17. mov eax, [mxcsr]
  18. and ax, 0x9F80
  19. or ah, %1
  20. mov [mxcsr], eax
  21. ldmxcsr [mxcsr]
  22. %endmacro
  23. %include "header.inc"
  24. setRoundingBits 0x00 ; Round to nearest
  25. cvtps2pi mm0, [float0low]
  26. cvtps2pi mm4, [float1low]
  27. setRoundingBits 0x20 ; Round down
  28. cvtps2pi mm1, [float0low]
  29. cvtps2pi mm5, [float1low]
  30. setRoundingBits 0x40 ; Round up
  31. cvtps2pi mm2, [float0low]
  32. cvtps2pi mm6, [float1low]
  33. setRoundingBits 0x60 ; Round toward zero
  34. cvtps2pi mm3, [float0low]
  35. cvtps2pi mm7, [float1low]
  36. %include "footer.inc"