public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH: Have may_trap_p depend on flag_trapping_math
@ 2001-11-13 15:03 Brad Lucier
  0 siblings, 0 replies; only message in thread
From: Brad Lucier @ 2001-11-13 15:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: Brad Lucier

This is a fairly straightforward patch that has may_trap_p take
account of the flag_trapping_math flag when deciding whether some
RTL can trap. It bootstrapped fine on alphaev6-unknown-linux-gnu
with 

../configure --enable-languages='c,c++,java,f77,objc'

and

make bootstrap BOOT_CFLAGS='-O2 -g -fno-math-errno -fno-trapping-math -mieee'

There were a few differences in the test suite, but for the life of me
I can't see why from the test logs, left is without the change, right
is with the change.

16a17
> FAIL: Primes -O output from bytecode->native test
28,29c29,30
< # of expected passes          1811
< # of unexpected failures      13
---
> # of expected passes          1810
> # of unexpected failures      14
51c52
< FAIL: g77.dg/fcase-preserve.f execution test
---
> FAIL: g77.dg/fbackslash.f execution test
54a56
> FAIL: g77.dg/ff90-1.f (test for excess errors)
58c60,61
< FAIL: g77.dg/fno-vxt-1.f execution test
---
> FAIL: g77.dg/fonetrip.f execution test
> FAIL: g77.dg/fvxt-1.f execution test
170,171c173,174
< # of expected passes          1181
< # of unexpected failures      116
---
> # of expected passes          1175
> # of unexpected failures      118
206a210,213
> FAIL: g++.dg/init/array1.C execution test
> FAIL: g++.dg/init/init-ref1.C execution test
> FAIL: g++.dg/init/init-ref2.C execution test
> FAIL: g++.dg/template/qualttp11.C (test for excess errors)
219,220c226,227
< # of expected passes          6686
< # of unexpected failures      8
---
> # of expected passes          6683
> # of unexpected failures      12

	* rtlanal.c (may_trap_p): Take flag_trapping_math into account.

===================================================================
RCS file: RCS/rtlanal.c,v
retrieving revision 1.1
diff -cp -r1.1 rtlanal.c
*** rtlanal.c	2001/11/16 21:52:17	1.1
--- rtlanal.c	2001/11/16 22:04:22
*************** Software Foundation, 59 Temple Place - S
*** 26,31 ****
--- 26,32 ----
  #include "rtl.h"
  #include "hard-reg-set.h"
  #include "tm_p.h"
+ #include "flags.h"
  
  /* Forward declarations */
  static void set_of_1		PARAMS ((rtx, rtx, void *));
*************** may_trap_p (x)
*** 2087,2099 ****
      case MEM:
        return rtx_addr_can_trap_p (XEXP (x, 0));
  
-       /* Division by a non-constant might trap.  */
      case DIV:
      case MOD:
      case UDIV:
      case UMOD:
!       if (! CONSTANT_P (XEXP (x, 1))
! 	  || GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
  	return 1;
        /* This was const0_rtx, but by not using that,
  	 we can link this file into other programs.  */
--- 2088,2108 ----
      case MEM:
        return rtx_addr_can_trap_p (XEXP (x, 0));
  
      case DIV:
      case MOD:
      case UDIV:
      case UMOD:
!       /* If the MODE is MODE_FLOAT, rely on flag_trapping_math
! 	 to tell us if this can trap.  */
!       if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
! 	{
! 	  if (flag_trapping_math)
! 	    return 1;
! 	  else
! 	    break;
! 	}
!       /* Otherwise, division by a non-constant might trap.  */
!       if (! CONSTANT_P (XEXP (x, 1)))
  	return 1;
        /* This was const0_rtx, but by not using that,
  	 we can link this file into other programs.  */
*************** may_trap_p (x)
*** 2111,2117 ****
      case LE:
      case LT:
      case COMPARE:
!       /* Some floating point comparisons may trap.  */
        /* ??? There is no machine independent way to check for tests that trap
  	 when COMPARE is used, though many targets do make this distinction.
  	 For instance, sparc uses CCFPE for compares which generate exceptions
--- 2120,2129 ----
      case LE:
      case LT:
      case COMPARE:
!       /* Some floating point comparisons may trap, but only if
! 	 flag_trapping_math is nonzero.  */
!       if (! flag_trapping_math)
! 	break;
        /* ??? There is no machine independent way to check for tests that trap
  	 when COMPARE is used, though many targets do make this distinction.
  	 For instance, sparc uses CCFPE for compares which generate exceptions
*************** may_trap_p (x)
*** 2131,2138 ****
        break;
  
      default:
!       /* Any floating arithmetic may trap.  */
!       if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
  	return 1;
      }
  
--- 2143,2151 ----
        break;
  
      default:
!       /* Any floating arithmetic may trap if flag_trapping_math is 1.  */
!       if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT
! 	  && flag_trapping_math)
  	return 1;
      }
  

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

only message in thread, other threads:[~2001-11-17 16:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-13 15:03 PATCH: Have may_trap_p depend on flag_trapping_math Brad Lucier

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