Bug 58684 - powerpc uses only unordered floating-point compares
Summary: powerpc uses only unordered floating-point compares
Status: ASSIGNED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: ---
Assignee: Segher Boessenkool
URL:
Keywords: wrong-code
: 83759 84366 91331 (view as bug list)
Depends on:
Blocks: 93393
  Show dependency tree / graph
 
Reported: 2013-10-10 16:34 UTC by Joseph S. Myers
Modified: 2024-07-18 04:51 UTC (History)
3 users (show)

See Also:
Host:
Target: powerpc*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-03-21 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph S. Myers 2013-10-10 16:34:32 UTC
When compiling for powerpc (classic hard-float), floating-point compares always use the fcmpu instructions that don't raise exceptions for unordered operands, never the exception-raising fcmpo variants.  The correct behavior is to raise exceptions for comparisons such as "x < y", but not for "x == y" or "__builtin_isless (x, y)".
Comment 1 David Edelsohn 2015-03-21 18:38:03 UTC
This is language-dependent.  And the comparison insn must know which condition codes will be tested.
Comment 2 Joseph S. Myers 2018-01-09 23:08:27 UTC
*** Bug 83759 has been marked as a duplicate of this bug. ***
Comment 3 seurer 2018-01-30 16:51:47 UTC
Author: seurer
Date: Tue Jan 30 16:51:14 2018
New Revision: 257190

URL: https://gcc.gnu.org/viewcvs?rev=257190&root=gcc&view=rev
Log:
[PATCH, rs6000] pr58684, pr83759 xfail test cases that fail on powerpc64.

This patch xfails a few test cases on powerpc64 that fail after r256380
due to a longstanding issue with floating-point compares.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58684 for more information.


2018-01-30  Bill Seurer  <seurer@linux.vnet.ibm.com>

	PR 58684
	* gcc/testsuite/gcc.dg/torture/inf-compare-1.c: Add xfail.
	* gcc/testsuite/gcc.dg/torture/inf-compare-2.c: Add xfail.
	* gcc/testsuite/gcc.dg/torture/inf-compare-3.c: Add xfail.
	* gcc/testsuite/gcc.dg/torture/inf-compare-4.c: Add xfail.


Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/torture/inf-compare-1.c
    trunk/gcc/testsuite/gcc.dg/torture/inf-compare-2.c
    trunk/gcc/testsuite/gcc.dg/torture/inf-compare-3.c
    trunk/gcc/testsuite/gcc.dg/torture/inf-compare-4.c
Comment 4 Segher Boessenkool 2018-03-23 23:42:00 UTC
I have a patch.
Comment 5 Segher Boessenkool 2018-03-27 01:55:15 UTC
*** Bug 84366 has been marked as a duplicate of this bug. ***
Comment 6 Segher Boessenkool 2018-03-27 01:56:33 UTC
Patch at https://gcc.gnu.org/ml/gcc-patches/2018-03/msg01405.html .
Comment 7 Martin Liška 2018-11-19 12:59:29 UTC
Can the bug be marked as resolved?
Comment 8 jsm-csl@polyomino.org.uk 2018-11-19 13:47:13 UTC
I see no sign of Segher's patch to fix the bug (as opposed to some XFAILs 
pending a fix) having been committed, and a trivial testcase still 
generates fcmpu instructions with a compiler from yesterday, so no.
Comment 9 Segher Boessenkool 2018-11-19 17:48:00 UTC
It is not resolved yet no.  That patch has some biggish issues still.
Comment 10 Segher Boessenkool 2019-08-05 17:28:44 UTC
*** Bug 91331 has been marked as a duplicate of this bug. ***
Comment 11 GCC Commits 2024-04-28 07:42:24 UTC
The master branch has been updated by Alexandre Oliva <aoliva@gcc.gnu.org>:

https://gcc.gnu.org/g:6e95dca31c6b4688e0f0a25c9c3aa8a0bedc9056

commit r15-20-g6e95dca31c6b4688e0f0a25c9c3aa8a0bedc9056
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Sun Apr 28 04:30:24 2024 -0300

    xfail fetestexcept test - ppc always uses fcmpu
    
    gcc.dg/torture/pr91323.c tests that a compare with NaNf doesn't set an
    exception using builtin compare intrinsics, and that it does when
    using regular compare operators.
    
    That doesn't seem to be expected to work on powerpc targets.  It fails
    on GNU/Linux, it's marked to be skipped on AIX, and a similar test,
    gcc.dg/torture/pr93133.c, has the execution test xfailed for all of
    powerpc*-*-*.
    
    In this test, the functions that use intrinsics for the compare end up
    with the same code as the one that uses compare operators, using
    fcmpu, a floating compare that, unlike fcmpo, does not set the invalid
    operand exception for quiet NaN.  I couldn't find any evidence that
    the rs6000 backend ever outputs fcmpo.  Therefore, I'm adding the same
    execution xfail marker to this test.
    
    
    for  gcc/testsuite/ChangeLog
    
            PR target/58684
            * gcc.dg/torture/pr91323.c: Expect execution fail on
            powerpc*-*-*.