Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
761 B

  1. .file "frnd.s"
  2. .section .text
  3. .proc _frnd#
  4. .align 32
  5. .global _frnd#
  6. .align 32
  7. _frnd:
  8. // CONVERT BEGINS HERE WITH ARGUMENT IN f8
  9. { .mmi
  10. // save the old fpsr in r2
  11. mov r2=ar40;;
  12. mov r3=r2
  13. nop.i 0
  14. } { .mlx
  15. nop.m 0
  16. movl r8=0x02000;;
  17. } { .mmi
  18. // clear sf0.V bit in r3
  19. andcm r3=r3,r8;;
  20. // set traps.PDV
  21. or r3=0x23,r3
  22. nop.i 0;;
  23. } { .mib
  24. mov ar40=r3
  25. nop.i 0
  26. nop.b 0;;
  27. } { .mfi
  28. nop.m 0
  29. fcvt.fx.s0 f7=f8
  30. nop.i 0;;
  31. } { .mmi
  32. mov r3=ar40;;
  33. nop.m 0
  34. // examine the sf0.V bit (p6 = 1 if sf0.V set)
  35. tbit.z p6,p7=r3,0x0d;;
  36. } { .mfb
  37. nop.m 0
  38. (p6) fcvt.xf f8=f7
  39. nop.b 0;;
  40. }
  41. // CONVERT ENDS HERE WITH RESULT IN f8
  42. done:
  43. { .mmb
  44. mov ar40=r2
  45. // store result
  46. nop.m 0
  47. // return
  48. br.ret.sptk b0;;
  49. }
  50. .endp _frnd