Commit c0952176 by Ben Elliston Committed by Ben Elliston

ifc-20040816-2.c: Use integer arithmetic instead of floating point arithmetic, which could trap.

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

Co-Authored-By: Devang Patel <dpatel@apple.com>

From-SVN: r89313
parent dd365157
2004-10-20 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.
2004-10-19 Mark Mitchell <mark@codesourcery.com> 2004-10-19 Mark Mitchell <mark@codesourcery.com>
PR c++/14035 PR c++/14035
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-c -O2 -ftree-vectorize -fdump-tree-ifcvt-stats" { target *-*-* } } */ /* { dg-options "-c -O2 -ftree-vectorize -fdump-tree-ifcvt-stats" { target *-*-* } } */
typedef float afloat __attribute__ ((__aligned__(16))); void foo(const int * __restrict__ zr_in,
void foo(const afloat * __restrict__ zr_in, const int * __restrict__ zi_in,
const afloat * __restrict__ zi_in, const int * __restrict__ zk_in,
const afloat * __restrict__ zk_in, int * __restrict__ zr_out,
afloat * __restrict__ zr_out, int * __restrict__ zi_out,
afloat * __restrict__ zi_out, int * __restrict__ zk_out,
afloat * __restrict__ zk_out, int cr, int ci)
float cr, float ci)
{ {
unsigned int pi; unsigned int pi;
float tmp_r, tmp_i, tmp_k; int tmp_r, tmp_i, tmp_k;
for (pi = 0; pi < (512)*(512); pi++) { for (pi = 0; pi < (512)*(512); pi++) {
float zr = zr_in[pi]; int zr = zr_in[pi];
float zi = zi_in[pi]; int zi = zi_in[pi];
float zk = zk_in[pi]; int zk = zk_in[pi];
if (zr*zr + zi*zi >= 4.0f) { if (zr*zr + zi*zi >= 4) {
tmp_r = zr; tmp_r = zr;
tmp_i = zi; tmp_i = zi;
tmp_k = zk; tmp_k = zk;
} else { } else {
tmp_r = (zr*zr - zi*zi + cr); tmp_r = (zr*zr - zi*zi + cr);
tmp_i = (2 * zr * zi + ci); tmp_i = (2 * zr * zi + ci);
tmp_k = zk + 1.0f; tmp_k = zk + 1;
} }
zr_out[pi] = tmp_r; zr_out[pi] = tmp_r;
zi_out[pi] = tmp_i; zi_out[pi] = tmp_i;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment