public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: jakub@redhat.com
To: gcc-gnats@gcc.gnu.org
Cc: wilson@redhat.com, vmakarov@redhat.com
Subject: optimization/9735: IA-64 doesn't honor trapping math when doing final schedule
Date: Mon, 17 Feb 2003 22:46:00 -0000	[thread overview]
Message-ID: <20030217224044.26496.qmail@sources.redhat.com> (raw)


>Number:         9735
>Category:       optimization
>Synopsis:       IA-64 doesn't honor trapping math when doing final schedule
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 17 22:46:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     jakub@redhat.com
>Release:        3.0 ... 3.4 20031117
>Organization:
>Environment:
ia64-*-linux*
>Description:
sched-ebb.c doesn't honor may_trap_p when scheduling
during ia64_machine_reorg, so a possibly trapping insn (in
the testcase below fcmp.lt) can be scheduled before a branch
in the same extended basic block which should protect it.
I've tried to add haifa_classify_insn (insn) == TRAP_RISKY
checks into sched-ebb.c's new_ready and init_ready_list,
but probably more changes are needed to get it working.
>How-To-Repeat:
/* { dg-do run { target ia64-*-linux* } } */
/* { dg-options "-O3" } } */

int __attribute__((noinline, const))
ret4 (float value)
{
  return 4;
}

int __attribute__((noinline, const))
ret0 (float value)
{
  return 0;
}

float __attribute__((noinline))
test (float x, float y)
{
  int clsx = ret4 (x);
  int clsy = ret0 (y);

  if (clsx == 0 || clsy == 0
      || (y < 0 && clsx == 1 && clsy == 1))
    return x - y;

  return x < y ? 0 : x - y;
}

float a = 0.0, b;

int main (void)
{
  unsigned long e;
  b = a / a;
  __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (e));
  e &= ~0x7e000UL;
  __asm__ __volatile__ ("mov.m ar.fpsr=%0" :: "r" (e) : "memory");
  a = test (0, b);
  __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (e));
  if (e & 0x2000)
    abort ();
  exit (0);
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


                 reply	other threads:[~2003-02-17 22:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20030217224044.26496.qmail@sources.redhat.com \
    --to=jakub@redhat.com \
    --cc=gcc-gnats@gcc.gnu.org \
    --cc=vmakarov@redhat.com \
    --cc=wilson@redhat.com \
    /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).