diff options
author | Richard Earnshaw <rearnsha@arm.com> | 2015-09-24 09:40:06 +0000 |
---|---|---|
committer | Richard Earnshaw <rearnsha@gcc.gnu.org> | 2015-09-24 09:40:06 +0000 |
commit | 4dfe21acc2072b7dd35cd57ced94cf880b896158 (patch) | |
tree | febf915b6babe064024fc102cdb1a878c5287c89 /libgcc/config/arm/fp16.c | |
parent | 60dd79ca89f7eb0c4bded86766c7d17d171aba7f (diff) | |
download | gcc-4dfe21acc2072b7dd35cd57ced94cf880b896158.zip gcc-4dfe21acc2072b7dd35cd57ced94cf880b896158.tar.gz gcc-4dfe21acc2072b7dd35cd57ced94cf880b896158.tar.bz2 |
ARM: fp16 Fix PR 67624 - Incorrect conversion of float Infinity to __fp16
PR libgcc/67624
libgcc:
* config/arm/fp16.c (__gnu_f2h_internal): Handle infinity correctly.
gcc/testsuite:
* gcc.target/arm/fp16-inf.c: New test.
From-SVN: r228082
Diffstat (limited to 'libgcc/config/arm/fp16.c')
-rw-r--r-- | libgcc/config/arm/fp16.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libgcc/config/arm/fp16.c b/libgcc/config/arm/fp16.c index 86a6348..8eaae2b 100644 --- a/libgcc/config/arm/fp16.c +++ b/libgcc/config/arm/fp16.c @@ -35,9 +35,12 @@ __gnu_f2h_internal(unsigned int a, int ieee) { if (!ieee) return sign; + if (mantissa == 0) + return sign | 0x7c00; /* Infinity. */ + /* Remaining cases are NaNs. Convert SNaN to QNaN. */ return sign | 0x7e00 | (mantissa >> 13); } - + if (aexp == 0 && mantissa == 0) return sign; @@ -49,7 +52,7 @@ __gnu_f2h_internal(unsigned int a, int ieee) { mask = 0x00ffffff; if (aexp >= -25) - mask >>= 25 + aexp; + mask >>= 25 + aexp; } else mask = 0x00001fff; |