public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix for ifc-20040816-2.c test case
@ 2004-10-19  2:51 Ben Elliston
  2004-10-19 23:29 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Elliston @ 2004-10-19  2:51 UTC (permalink / raw)
  To: gcc-patches

The following patch modifies the ifc-20040816-2.c test to allow the
if-conversion pass to do its thing.  The if-conversion was being
inhibited by some floating point expressions, which could trap.  I've
converted the test to use integer arithmetic instead.  Okay for
mainline?


2004-10-19  Ben Elliston  <bje@au.ibm.com>
	    Devang Patel  <dpatel@apple.com>

	* gcc.dg/tree-ssa/ifc-20040816-2.c: Use integer arithmetic instead
	of floating point arithmetic, which could trap.

--- ifc-20040816-2.c	6 Sep 2004 23:14:43 -0000	1.2
+++ ifc-20040816-2.c	19 Oct 2004 02:08:32 -0000
@@ -1,30 +1,29 @@
 /* { dg-do compile } */
 /* { dg-options "-c -O2 -ftree-vectorize -fdump-tree-ifcvt-stats" { target *-*-* } } */
 
-typedef float afloat __attribute__ ((__aligned__(16)));
-void foo(const afloat * __restrict__ zr_in,
-		const afloat * __restrict__ zi_in,
-		const afloat * __restrict__ zk_in,
-		afloat * __restrict__ zr_out,
-		afloat * __restrict__ zi_out,
-		afloat * __restrict__ zk_out,
-		float cr, float ci)
+void foo(const int * __restrict__ zr_in,
+		const int * __restrict__ zi_in,
+		const int * __restrict__ zk_in,
+		int * __restrict__ zr_out,
+		int * __restrict__ zi_out,
+		int * __restrict__ zk_out,
+		int cr, int ci)
 {
   unsigned int pi;
-  float tmp_r, tmp_i, tmp_k;
+  int tmp_r, tmp_i, tmp_k;
   for (pi = 0; pi < (512)*(512); pi++) {
-    float zr = zr_in[pi];
-    float zi = zi_in[pi];
-    float zk = zk_in[pi];
+    int zr = zr_in[pi];
+    int zi = zi_in[pi];
+    int zk = zk_in[pi];
     
-    if (zr*zr + zi*zi >= 4.0f) {
+    if (zr*zr + zi*zi >= 4) {
       tmp_r = zr;
       tmp_i = zi;
       tmp_k = zk;
     } else {
       tmp_r = (zr*zr - zi*zi + cr);
       tmp_i = (2 * zr * zi + ci);
-      tmp_k = zk + 1.0f;
+      tmp_k = zk + 1;
     }
     zr_out[pi] = tmp_r;
     zi_out[pi] = tmp_i;

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

* Re: Fix for ifc-20040816-2.c test case
  2004-10-19  2:51 Fix for ifc-20040816-2.c test case Ben Elliston
@ 2004-10-19 23:29 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2004-10-19 23:29 UTC (permalink / raw)
  To: Ben Elliston; +Cc: gcc-patches

On Tue, Oct 19, 2004 at 12:11:12PM +1000, Ben Elliston wrote:
> 	* gcc.dg/tree-ssa/ifc-20040816-2.c: Use integer arithmetic instead
> 	of floating point arithmetic, which could trap.

Ok.


r~

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

end of thread, other threads:[~2004-10-19 23:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-19  2:51 Fix for ifc-20040816-2.c test case Ben Elliston
2004-10-19 23:29 ` Richard Henderson

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