cif8.s 722 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #
  2. ! $Source$
  3. ! $State$
  4. ! $Revision$
  5. #include "powerpc.h"
  6. .sect .text
  7. ! Converts a 32-bit integer into a 64-bit double.
  8. !
  9. ! Stack: ( int -- double )
  10. .define .cif8
  11. .cif8:
  12. addi sp, sp, -4 ! make space for the double
  13. lwz r3, 4(sp)
  14. xoris r3, r3, 0x8000
  15. stw r3, 4(sp) ! flip sign of integer value
  16. addis r3, r0, 0x4330
  17. stw r3, 0(sp) ! set high word to construct a double
  18. lfd f0, 0(sp) ! load value
  19. la (r3, pivot)
  20. lfd f1, 0(r3) ! load pivot value
  21. fsub f0, f0, f1 ! adjust
  22. stfd f0, 0(sp) ! save value again...
  23. bclr ALWAYS, 0, 0 ! ...and return
  24. .sect .rom
  25. pivot:
  26. .data4 0x43300000
  27. .data4 0x80000000