* [committed][PATCH] Fix m68k soft float handling of infinity
@ 2018-05-23 22:29 Jeff Law
0 siblings, 0 replies; only message in thread
From: Jeff Law @ 2018-05-23 22:29 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 744 bytes --]
This was reported over on the older gcc@ list.
Essentially the soft-float code for m68k mis-handles the sign bit for
32bit floating point addition when one or both arguments is infinity.
Essentially we try to extract the sign bit from a saved copy of the
input value. However we saved the input value *after* its sign bit had
already been cleared. Fixing is pretty easy -- we just need to move
the save point earlier.
64bit floating point appears to handle this correctly.
I seriously considered mirroring how the 64bit path handles this
situation but that was going to require a bit more surgery and given the
lack of testing infrastructure for m68k soft-float the risk/reward
didn't seem worth it to me.
Installed on the trunk.
Jeff
[-- Attachment #2: P --]
[-- Type: text/plain, Size: 1381 bytes --]
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index e8886cfda77..1b24190cf30 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,8 @@
+2018-05-23 Kalamatee <kalamatee@gmail.com>
+
+ * config/m68k/lb1sf68.S (Laddsf$nf): Fix sign bit handling in
+ path to Lf$finfty.
+
2018-05-18 Kito Cheng <kito.cheng@gmail.com>
Monk Chiang <sh.chiang04@gmail.com>
Jim Wilson <jimw@sifive.com>
diff --git a/libgcc/config/m68k/lb1sf68.S b/libgcc/config/m68k/lb1sf68.S
index 1d9392a4ef7..325a7c17d9b 100644
--- a/libgcc/config/m68k/lb1sf68.S
+++ b/libgcc/config/m68k/lb1sf68.S
@@ -3111,6 +3111,8 @@ Laddsf$nf:
movel a6@(12),d1 | did some processing already)
movel IMM (INFINITY),d4 | useful constant (INFINITY)
movel d0,d2 | save sign bits
+ movel d0,d7 | into d7 as well as we may need the sign
+ | bit before jumping to LfSinfty
movel d1,d3
bclr IMM (31),d0 | clear sign bits
bclr IMM (31),d1
@@ -3125,7 +3127,6 @@ Laddsf$nf:
| are adding or subtracting them.
eorl d3,d2 | to check sign bits
bmi 1f
- movel d0,d7
andl IMM (0x80000000),d7 | get (common) sign bit
bra Lf$infty
1:
@@ -3135,7 +3136,6 @@ Laddsf$nf:
cmpl d1,d0 | are both infinite?
beq Lf$inop | if so return NaN
- movel d0,d7
andl IMM (0x80000000),d7 | get a's sign bit '
cmpl d4,d0 | test now for infinity
beq Lf$infty | if a is INFINITY return with this sign
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-05-23 22:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-23 22:29 [committed][PATCH] Fix m68k soft float handling of infinity Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).