> Hi, > > The patch that Andrew Stubbs sent upstream here: > > http://gcc.gnu.org/ml/gcc-patches/2011-04/msg02130.html > > seems to have become stalled after Ramana's question here: > > http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00291.html > > This was discussed with ARM personnel (i.e. Lee Smith) at the time the > patch was created. AFAICT, our reasoning went like this (Paul, please > correct me if I'm just making stuff up): we wish to use aliases for the > old and new names for the helpers. The existing > __gnu_{f2h,h2f}_{ieee,alternative} helpers take unsigned short > arguments, and therefore assume (on function entry) that the values > contained in those arguments are zero-extended (although, due to the > vagaries of libcall handling in GCC, that may not actually be true -- > at the time, this was a latent bug, and may in fact still be). The > __aeabi_* helpers are defined to pass/return unadorned "short" values, > intending to convey that only the low-order 16 bits of half-float > values contain meaningful data.
Yes, that matches my understanding. > But, that means EABI-conformant callers are also perfectly entitled to > sign-extend half-float values before calling our helper functions > (although GCC itself won't do that). Using "unsigned int" and taking > care to only examine the low-order bits of the value in the helper > function itself serves to fix the latent bug, is compatible with > existing code, allows us to be conformant with the eabi, and allows use > of aliases to make the __gnu and __aeabi functions the same. As long as LTO never sees this mismatch we should be fine :-) AFAIK we don't curently have any way of expressing the actual ABI. > The patch no longer applied as-is, so I've updated it (attached, > re-tested). Note that there are no longer any target-independent changes > (though I'm not certain that the symbol versions are still correct). > > OK to apply? I think this deserves a comment in the source. Otherwise it's liable to get "fixed" in the future :-) Something allong the lines of "While the EABI describes the arguments to the half-float helper routines as 'short', it does not require that they be extended to full register width. The normal ABI requres that the caller sign/zero extend short values to 32 bit. We use unsigned int arguments to prevent the gcc making assumptions about the high half of the register." Paul