diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2011-11-08 03:20:30 +0000 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2011-11-08 03:20:30 +0000 |
commit | 47180e1668b0766d1e473fed8d9385c0e765285d (patch) | |
tree | 1eb48ad31d05a9ce117bedc17115de96dffa2f0b /libgcc/floatunsisf.c | |
parent | 80b9b1c40004ddf7dd74248b642d489384f37ace (diff) | |
parent | eb6a1d75b768b663579adeb2a50828cf679b6f12 (diff) |
* Merge from mainline rev 181122.transactional-memory
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/transactional-memory@181148 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgcc/floatunsisf.c')
-rw-r--r-- | libgcc/floatunsisf.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libgcc/floatunsisf.c b/libgcc/floatunsisf.c new file mode 100644 index 00000000000..11d4aa78cbe --- /dev/null +++ b/libgcc/floatunsisf.c @@ -0,0 +1,18 @@ +/* Public domain. */ +typedef int SItype __attribute__ ((mode (SI))); +typedef unsigned int USItype __attribute__ ((mode (SI))); +typedef float SFtype __attribute__ ((mode (SF))); + +SFtype +__floatunsisf (USItype u) +{ + SItype s = (SItype) u; + if (s < 0) + { + /* As in expand_float, compute (u & 1) | (u >> 1) to ensure + correct rounding if a nonzero bit is shifted out. */ + return (SFtype) 2.0 * (SFtype) (SItype) ((u & 1) | (u >> 1)); + } + else + return (SFtype) s; +} |