Re: Phix: float32 return value
- Posted by petelomax 6 days ago
- 138 views
Oh my, that is an absolutely perfect error report, can I just say well done and thankyou!
The fix itself is pretty straightforward, pcfunc.e ~line 2219 should end up as
cmp rdx,0x03000004 -- (C_FLOAT)
-- je :cstorexmm0
jne @f
sub rsp,8
movss dword[rsp],xmm0
fld dword[rsp]
jmp :cstorest0
@@:
cmp rdx,0x03000008 -- (C_DOUBLE)
jne @f
-- ::cstorexmm0
-- 14/2/16: (certainly C_DOUBLE, not necessarily C_FLOAT?) [25/2, I think it's the same]
sub rsp,8
movsd qword[rsp],xmm0
fld qword[rsp]
::cstorest0
add rsp,8
However, 1.0.5 does not implement movss, which needs, before making the above changes:
pttree.e line 1289:
global constant T_swi = 6060 tt_stringF("swi",T_swi)
global constant T_movss = 6068 tt_stringF("movss",T_movss)
pilasm.e line 4333:
-- elsif ttidx=T_movsd then
elsif ttidx=T_movsd
or ttidx=T_movss then
op = iff(ttidx=T_movsd?0o362:0o363)
and ten/twenty lines on:
-- s5 &= {0o362,0o017,0o020}
s5 &= {op,0o017,0o020}
-- s5 &= {0o362,0o017,0o021}
s5 &= {op,0o017,0o021}
You'll then need to run p -c p, then make the changes to pcfunc.e, then run p -c p again.
Actually, probably best if you just change pttree.e first and quickly check by running "p p"
whether you get anything like "movss should be 6068(not 6064)", if not kill it and carry on.
Finally, a quick "p -test" should reassure you nothing else got broken.
Thanks again, I would probably never have found or fixed that without your help.

