This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] powerpc: Add a POWER8 implementation for GET|SET_FLOAT_WORD
On 20/12/2016 16:46, Joseph Myers wrote:
> On Tue, 20 Dec 2016, Tulio Magno Quites Machado Filho wrote:
>
>> Provides a POWER8-specific implementation for GET_FLOAT_WORD and
>> SET_FLOAT_WORD that is able to extract or set a float using only VSR and
>> GPR.
>
> Why doesn't the compiler handle this automatically when building for
> POWER8? My comments in
> <https://sourceware.org/ml/libc-alpha/2016-06/msg01180.html> apply equally
> here (but reinterpretation of a bit pattern between integer and float is
> more generic than bitwise masking of a float, so a wider range of code is
> likely to benefit from such a compiler optimization).
>
Looks like GCC, at least master (7.0.0), does generate awful code for
this conversion. It does use a xscvdpuxws+mfvsrd, but still store and
load the float memory as pre-ISA 2.07 expectation plus a lot of
superfluous precision instructions. Double precision to 64 bits integers
is somewhat better (mtvsrd plus 2 fcfidu), but the contrary (64 bits
integer to double precision) is also far from optimal.
And I agree with Joseph here, these optimization should be handled
by the compiler.