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 | |
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')
-rw-r--r-- | libgcc/ChangeLog | 5 | ||||
-rw-r--r-- | libgcc/config/arm/fp16.c | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index cc5c2c3..dee1c11 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,8 @@ +2015-09-24 Richard Earnshaw <rearnsha@arm.com> + + PR libgcc/67624 + * config/arm/fp16.c (__gnu_f2h_internal): Handle infinity correctly. + 2015-09-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * config.host (*-*-solaris2*): Add t-crtstuff-pic to tmake_file. 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; |