https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59478
--- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> --- (In reply to Oleg Endo from comment #0) > This happens at least on SH with trunk rev 205905 (4.9). > I'm not sure whether these are target specific or not. > > Accessing float values as integers can be done in various ways. One way is > to do a byte copy... > > int float_as_int (float val) > { > char valbytes[sizeof (float)]; > __builtin_memcpy (valbytes, &val, sizeof (float)); > > int result; > __builtin_memcpy (&result, valbytes, sizeof (float)); > > return result; > } > > The above compiled with -m4-single -ml -O2 results in: > > add #-8,r15 > fmov.s fr5,@r15 > mov.l @r15,r0 > rts > add #8,r15 > > which is not so bad actually, but could be done better by utilizing the fpul > register, as it is done when using the union approach: This case got better. It now produces the expected sequence: flds fr5,fpul rts sts fpul,r0