Trying to figure out what happens when I call “float_of_int” for native compilation to amd64 and arm64. I understand that the Cmm generated is roughly
box_float (Cop(Cfloatofint (untag_int myfloat))). What does Cfloatofint get translated to?
Underlying Motivation: Looking at how the fast pass of the Eisel-Lemire float parsing algorithm would look like in OCaml.
amd64 it is translated into the sequence
sarq $1, %rax
cvtsi2sdq %rax, %xmm0
%rax contains the integer. The resulting double in
%xmm0 may be boxed depending on the context.
I don’t have an arm64 machine at hand to try.
sarq part is actually
scvtf is used.
Thanks, indeed. I was rather thinking of
float_of_int instead of