public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "stefansf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/114678] New: FAIL: gcc.dg/tree-ssa/range-sincos.c scan-tree-dump-not evrp "link_error" on s390
Date: Wed, 10 Apr 2024 13:39:28 +0000	[thread overview]
Message-ID: <bug-114678-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114678

            Bug ID: 114678
           Summary: FAIL: gcc.dg/tree-ssa/range-sincos.c
                    scan-tree-dump-not evrp "link_error" on s390
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stefansf at gcc dot gnu.org
  Target Milestone: ---
            Target: s390*-*-*

FAIL: gcc.dg/tree-ssa/range-sincos.c scan-tree-dump-not evrp "link_error"

I assume this is due to the case that on s390 we have an isinf optab.  Thus,
prior evrp we end up with

void bar (double x)
{
  int _1;
  double _5;

  <bb 2> :
  _5 = sin (x_4(D));
  if (_5 ord _5)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 3> :
  _1 = __builtin_isinf (x_4(D));
  if (_1 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  link_error ();

  <bb 5> :
  return;

}

whereas, e.g., on x86-64 we have

void bar (double x)
{
  double _1;
  double _7;

  <bb 2> :
  _7 = sin (x_6(D));
  if (_7 ord _7)
    goto <bb 3>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 3> :
  if (x_6(D) unord x_6(D))
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  link_error ();

  <bb 5> :
  _1 = ABS_EXPR <x_6(D)>;
  if (_1 u<= 1.79769313486231570814527423731704356798070567525844996599e+308)
    goto <bb 7>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 6> :
  link_error ();

  <bb 7> :
  return;

}

If this optimization is all about ABS_EXPR the following patch would work on
s390x and x86-64:

@@ -24,20 +24,20 @@ bar (double x)
     {
       if (__builtin_isnan (x))
        link_error ();
-      if (__builtin_isinf (x))
+      if (__builtin_fabs (x) == __builtin_inf ())
        link_error ();
     }
 }

However, I'm not sure whether this is not also a missed optimization in case of
an isinf optab?

             reply	other threads:[~2024-04-10 13:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-10 13:39 stefansf at gcc dot gnu.org [this message]
2024-04-10 16:48 ` [Bug tree-optimization/114678] " rguenth at gcc dot gnu.org
2024-04-10 16:51 ` pinskia at gcc dot gnu.org
2024-04-11 13:30 ` stefansf at gcc dot gnu.org
2024-04-11 21:12 ` pinskia at gcc dot gnu.org
2024-04-12  8:38 ` stefansf at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-114678-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).