re PR other/63387 (Optimize pairs of isnan() calls into a single isunordered())
[official-gcc.git] / libgcc / floatunsisf.c
blob11d4aa78cbe29d700534a41f677b85cf5b7fce16
1 /* Public domain. */
2 typedef int SItype __attribute__ ((mode (SI)));
3 typedef unsigned int USItype __attribute__ ((mode (SI)));
4 typedef float SFtype __attribute__ ((mode (SF)));
6 SFtype
7 __floatunsisf (USItype u)
9 SItype s = (SItype) u;
10 if (s < 0)
12 /* As in expand_float, compute (u & 1) | (u >> 1) to ensure
13 correct rounding if a nonzero bit is shifted out. */
14 return (SFtype) 2.0 * (SFtype) (SItype) ((u & 1) | (u >> 1));
16 else
17 return (SFtype) s;