47bd0ef7a7
Do the conversion by calling .cif8 or .cuf8 in libem, as it was done before my commit1de1e8f
. I used the inline conversion to experiment with the register allocator, which was too slow untilc5bb3be
. Now that libem has the only copy of the code, move some comments and code changes there.
26 lines
600 B
ArmAsm
26 lines
600 B
ArmAsm
.sect .text
|
|
|
|
! Converts a 32-bit unsigned integer into a 64-bit double.
|
|
!
|
|
! Stack: ( uint -- double )
|
|
|
|
.define .cuf8
|
|
.cuf8:
|
|
! Conversion uses the pivot value
|
|
! 1 << 52 = 0x4330 0000 0000 0000
|
|
!
|
|
! From unsigned integer u, we compute
|
|
! ((1 << 52) + u) - (1 << 52)
|
|
|
|
lis r3, 0x4330
|
|
stwu r3, -4(sp) ! make space for the double
|
|
|
|
lfd f0, 0(sp) ! f0 = (1 << 52) + u
|
|
li r3, 0x0000
|
|
stw r3, 4(sp)
|
|
lfd f1, 0(sp) ! f1 = (1 << 52)
|
|
fsub f0, f0, f1 ! finish conversion
|
|
|
|
stfd f0, 0(sp) ! save value again...
|
|
blr ! ...and return
|