summaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>2015-09-24 09:40:06 +0000
committerrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>2015-09-24 09:40:06 +0000
commit0ed0ef698c866882fe1f78a8f930e00d4b5cbadd (patch)
treefebf915b6babe064024fc102cdb1a878c5287c89 /libgcc
parent24500bbaac87c5e55ded55cb1d4aabca89be1649 (diff)
downloadgcc-0ed0ef698c866882fe1f78a8f930e00d4b5cbadd.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228082 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgcc')
-rw-r--r--libgcc/ChangeLog5
-rw-r--r--libgcc/config/arm/fp16.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index cc5c2c3903b..dee1c115280 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 86a6348aecf..8eaae2b84e7 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;