public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/9735: IA-64 doesn't honor trapping math when doing final schedule
@ 2003-02-17 22:46 jakub
  0 siblings, 0 replies; only message in thread
From: jakub @ 2003-02-17 22:46 UTC (permalink / raw)
  To: gcc-gnats; +Cc: wilson, vmakarov


>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:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-02-17 22:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-17 22:46 optimization/9735: IA-64 doesn't honor trapping math when doing final schedule jakub

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