[compiler-rt] Use integers for __gnu_h2f_ieee and __gnu_f2h_ieee (#220167)
In libgcc, these conversion routines use integers in the signature. In
practice compiler-rt's definition has worked because the AAPCS calling
convention passes and returns floats the same as the same-sized integer,
but this may not be the case on all platforms. Thus, update the
signatures to match GCC.
This new version calls the inlined functions directly., changing the
generated code from:
00000000 <__extendhfsf2>:
0: ee100a10 vmov r0, s0
4: e1a01000 mov r1, r0
<snip>
60: e1800001 orr r0, r0, r1
64: ee000a10 vmov s0, r0
68: e12fff1e bx lr
0000006c <__gnu_h2f_ieee>:
6c: e92d4800 push {fp, lr}
70: ee000a10 vmov s0, r0
74: ebfffffe bl 0 <__extendhfsf2>
78: ee100a10 vmov r0, s0
7c: e8bd8800 pop {fp, pc}
To:
00000000 <__extendhfsf2>:
0: ee100a10 vmov r0, s0
4: e1a01000 mov r1, r0
<snip>
60: e1800001 orr r0, r0, r1
64: ee000a10 vmov s0, r0
68: e12fff1e bx lr
0000006c <__gnu_h2f_ieee>:
6c: e1a01000 mov r1, r0
70: e7e42550 ubfx r2, r0, #10, #5
<snip>
c8: e1800001 orr r0, r0, r1
cc: e12fff1e bx lr
This avoids an unnecessary indirection and register shuffle when calling
`__gnu_h2f_ieee`. It does mean the code is effectively duplicated
however, since any given target will only ever use `__gnu_h2f_ieee` or
`__extendhfsf2` but never mix them, this is an improvement in the final
binary. (The same logic applies to `__gnu_f2h_ieee` and `__truncsfhf2`.)
GitOrigin-RevId: 316d12deb7725d55f90c01b72799df18a7d71d81
4 files changed