[Bug tree-optimization/37837] New: missed PRE
rguenth at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Oct 15 09:58:00 GMT 2008
Testcase where only one constant, not two alternative constants, are on the
entry of the threaded bb.
extern int printf (const char *, ...);
void
__attribute__((noinline))
test (double cn, int *neig)
{
double tt, al[3];
*neig = 3;
if (__builtin_fabs(cn) > 1.)
cn = -1.;
tt = __builtin_atan2 (__builtin_sqrt (1. - __builtin_pow (cn, 2.)), cn)
* 3.333333333333333e-1;
al[0] = __builtin_cos (tt);
al[1] = __builtin_cos (2.0943951023931944 + tt);
al[2] = __builtin_cos (4.1887902047863879 + tt);
if ((__builtin_fabs ( al[0] - al[1]) < 1.e-5)
|| (__builtin_fabs (al[0] - al[2]) < 1.e-5)
|| (__builtin_fabs (al[1] - al[2]) < 1.e-5))
*neig = 2;
}
int
main ()
{
int neig;
test (-1.0, &neig);
printf ("neig = %d\n", neig);
if (neig != 2)
__builtin_abort ();
test (1.0, &neig);
printf ("neig = %d\n", neig);
if (neig != 2)
__builtin_abort ();
test (-2.0, &neig);
printf ("neig = %d\n", neig);
if (neig != 2)
__builtin_abort ();
return 0;
}
cn == -1 is available.
--
Summary: missed PRE
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37837
More information about the Gcc-bugs
mailing list