public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/47914] New: __builtin_isunordered(Inf, NaN) doesn't work on linux-m68k/aranym
@ 2011-02-27 14:12 mikpe at it dot uu.se
2011-02-27 14:30 ` [Bug target/47914] " schwab@linux-m68k.org
2012-02-25 19:36 ` schwab@linux-m68k.org
0 siblings, 2 replies; 3+ messages in thread
From: mikpe at it dot uu.se @ 2011-02-27 14:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47914
Summary: __builtin_isunordered(Inf, NaN) doesn't work on
linux-m68k/aranym
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mikpe@it.uu.se
> cat compare-fp-1.c
/* derived from gcc.c-torture/execute/ieee/compare-fp-1.c */
float pinf;
float NaN;
void iun (void)
{
float x = pinf;
float y = NaN;
if (!__builtin_isunordered (x, y))
__builtin_abort();
}
int main (void)
{
pinf = __builtin_inf ();
NaN = __builtin_nan ("");
iun ();
return 0;
}
> gcc -O1 compare-fp-1.c ; ./a.out
Abort
> gcc -O1 -S compare-fp-1.c ; cat compare-fp-1.s
#NO_APP
.file "compare-fp-1.c"
.text
.align 2
.globl iun
.type iun, @function
iun:
fmove.s pinf,%fp0
fcmp.s NaN,%fp0
fjun .L1
jsr abort
.L1:
rts
.size iun, .-iun
.align 2
.globl main
.type main, @function
main:
move.l #0x7f800000,pinf
move.l #0x7fffffff,NaN
jsr iun
clr.l %d0
rts
.size main, .-main
.comm NaN,4,2
.comm pinf,4,2
.ident "GCC: (GNU) 4.6.0 20110226 (experimental)"
.section .note.GNU-stack,"",@progbits
I'm not an expert on m68k FPU instructions, but this looks correct. The bug
occurs with gcc-4.4/4.5/4.6 at all optimization levels. In the gcc testsuite
it causes gcc.c-torture/execute/ieee/compare-fp-1.c to fail. There are lots of
other FP test failures too, that may or may not be related to this one.
However, I'm running this on aranym (aranym-0.9.10-1.1.x86_64.rpm), so it's
possible that aranym is broken. A gdb session seems to support that:
> gdb ./a.out
...
(gdb) break iun
Breakpoint 1 at 0x800003f8
(gdb) display/x $fpstatus
(gdb) display/i $pc
(gdb) run
Starting program: /home/mikpe/a.out
(no debugging symbols found)
(no debugging symbols found)
Breakpoint 1, 0x800003f8 in iun ()
2: x/i $pc
0x800003f8 <iun>: fmoves 0x80002670 <pinf>,%fp0
1: /x $fpstatus = 0x4000000
(gdb) stepi
0x80000400 in iun ()
2: x/i $pc
0x80000400 <iun+8>: fcmps 0x80002674 <NaN>,%fp0
1: /x $fpstatus = 0x2000000
(gdb)
0x80000408 in iun ()
2: x/i $pc
0x80000408 <iun+16>: fbun 0x80000412 <iun+26>
1: /x $fpstatus = 0x2000000
*** Shouldn't fcmp on a NaN operand set the NAN bit (bit 24) of fpstatus?
(gdb)
0x8000040c in iun ()
2: x/i $pc
0x8000040c <iun+20>: jsr 0x8000030c <abort@plt>
1: /x $fpstatus = 0x0
Could someone please test this on a real m68k with an FPU?
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/47914] __builtin_isunordered(Inf, NaN) doesn't work on linux-m68k/aranym
2011-02-27 14:12 [Bug target/47914] New: __builtin_isunordered(Inf, NaN) doesn't work on linux-m68k/aranym mikpe at it dot uu.se
@ 2011-02-27 14:30 ` schwab@linux-m68k.org
2012-02-25 19:36 ` schwab@linux-m68k.org
1 sibling, 0 replies; 3+ messages in thread
From: schwab@linux-m68k.org @ 2011-02-27 14:30 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47914
Andreas Schwab <schwab@linux-m68k.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> 2011-02-27 14:13:29 UTC ---
ARAnyM's fpu emulation is known to be incomplete and broken.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/47914] __builtin_isunordered(Inf, NaN) doesn't work on linux-m68k/aranym
2011-02-27 14:12 [Bug target/47914] New: __builtin_isunordered(Inf, NaN) doesn't work on linux-m68k/aranym mikpe at it dot uu.se
2011-02-27 14:30 ` [Bug target/47914] " schwab@linux-m68k.org
@ 2012-02-25 19:36 ` schwab@linux-m68k.org
1 sibling, 0 replies; 3+ messages in thread
From: schwab@linux-m68k.org @ 2012-02-25 19:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47914
--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> 2012-02-25 19:18:11 UTC ---
Try building aranym with --enable-fpe=mpfr.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-02-25 19:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-27 14:12 [Bug target/47914] New: __builtin_isunordered(Inf, NaN) doesn't work on linux-m68k/aranym mikpe at it dot uu.se
2011-02-27 14:30 ` [Bug target/47914] " schwab@linux-m68k.org
2012-02-25 19:36 ` schwab@linux-m68k.org
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).