ucomiss.asm 945 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. global _start
  2. section .data
  3. align 16
  4. controlword:
  5. dw 0
  6. dwordmxcsr:
  7. dw 0
  8. dword0:
  9. dd 1000.0
  10. dword1:
  11. dd 5.0
  12. dword2:
  13. dd 3000.0
  14. dwSNaN:
  15. dd __SNaN__
  16. dwQNaN:
  17. dd __QNaN__
  18. ; Moves EFLAGS into specified register
  19. %macro moveflags 1
  20. pushf
  21. and dword [esp], 0x45
  22. pop eax
  23. movd %1, eax
  24. %endmacro
  25. %include "header.inc"
  26. movd xmm0, [dword0]
  27. ; Equal
  28. ucomiss xmm0, [dword0]
  29. moveflags mm0 ; [ZF] = 100000
  30. ; Less than
  31. ucomiss xmm0, [dword1]
  32. moveflags mm1 ; [CF] = 000001
  33. ; Greater than
  34. ucomiss xmm0, [dword2]
  35. moveflags mm2 ; [] = 000000
  36. ; Unordered: Quiet NaN
  37. movd xmm1, [dwQNaN]
  38. ucomiss xmm0, xmm1
  39. moveflags mm3 ; [ZF][PF][CF] = 100101
  40. ; Check #I exception
  41. stmxcsr [dwordmxcsr]
  42. movd mm4, [dwordmxcsr]
  43. ; Unordered: Signaling NaN
  44. movd xmm1, [dwSNaN]
  45. ucomiss xmm0, xmm1
  46. moveflags mm5 ; [ZF][PF][CF] = 100101
  47. ; Check #I exception
  48. stmxcsr [dwordmxcsr]
  49. movd mm6, [dwordmxcsr]
  50. %include "footer.inc"