public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/114678] New: FAIL: gcc.dg/tree-ssa/range-sincos.c scan-tree-dump-not evrp "link_error" on s390
@ 2024-04-10 13:39 stefansf at gcc dot gnu.org
  2024-04-10 16:48 ` [Bug tree-optimization/114678] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: stefansf at gcc dot gnu.org @ 2024-04-10 13:39 UTC (permalink / raw)
  To: gcc-bugs

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?

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-12  8:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-10 13:39 [Bug tree-optimization/114678] New: FAIL: gcc.dg/tree-ssa/range-sincos.c scan-tree-dump-not evrp "link_error" on s390 stefansf at gcc dot gnu.org
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

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).