Commit 226855f0 by Bill Schmidt Committed by William Schmidt

re PR tree-optimization/46728 (GCC does not generate fmadd for pow (x, 0.75)+y on powerpc)

2011-05-27  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR tree-optimization/46728
	* gcc.target/powerpc/pr46728-1.c: New.
	* gcc.target/powerpc/pr46728-2.c: New.
	* gcc.target/powerpc/pr46728-3.c: New.
	* gcc.target/powerpc/pr46728-4.c: New.
	* gcc.target/powerpc/pr46728-5.c: New.
	* gcc.dg/pr46728-6.c: New.
	* gcc.target/powerpc/pr46728-7.c: New.
	* gcc.target/powerpc/pr46728-8.c: New.
	* gcc.dg/pr46728-9.c: New.
	* gcc.target/powerpc/pr46728-10.c: New.
	* gcc.target/powerpc/pr46728-11.c: New.
	* gcc.dg/pr46728-12.c: New.
	* gcc.target/powerpc/pr46728-13.c: New.
	* gcc.target/powerpc/pr46728-14.c: New.
	* gcc.target/powerpc/pr46728-15.c: New.
	* gcc.target/powerpc/pr46728-16.c: New.

From-SVN: r174358
parent a47d328f
2011-05-27 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR tree-optimization/46728
* gcc.target/powerpc/pr46728-1.c: New.
* gcc.target/powerpc/pr46728-2.c: New.
* gcc.target/powerpc/pr46728-3.c: New.
* gcc.target/powerpc/pr46728-4.c: New.
* gcc.target/powerpc/pr46728-5.c: New.
* gcc.dg/pr46728-6.c: New.
* gcc.target/powerpc/pr46728-7.c: New.
* gcc.target/powerpc/pr46728-8.c: New.
* gcc.dg/pr46728-9.c: New.
* gcc.target/powerpc/pr46728-10.c: New.
* gcc.target/powerpc/pr46728-11.c: New.
* gcc.dg/pr46728-12.c: New.
* gcc.target/powerpc/pr46728-13.c: New.
* gcc.target/powerpc/pr46728-14.c: New.
* gcc.target/powerpc/pr46728-15.c: New.
* gcc.target/powerpc/pr46728-16.c: New.
2011-05-27 Jason Merrill <jason@redhat.com>
* g++.dg/abi/mangle47.C: New.
......
/* { dg-do run } */
/* { dg-options "-O2 -ffast-math -fno-inline -fno-unroll-loops -lm" } */
#include <math.h>
extern void abort (void);
#define NVALS 6
static double
convert_it (double x)
{
return pow (x, 1.0 / 3.0);
}
int
main (int argc, char *argv[])
{
double values[NVALS] = { 3.0, 1.95, 2.227, 729.0, 64.0, .0008797 };
double PREC = 0.999999;
unsigned i;
for (i = 0; i < NVALS; i++)
if (fabs (convert_it (values[i]) / cbrt (values[i])) < PREC)
abort ();
return 0;
}
/* { dg-do compile } */
/* { dg-options "-O2 -ffast-math -lm" } */
#include <math.h>
int
main (int argc, char *argv[])
{
volatile double result;
result = pow (-0.0, 3.0);
result = pow (26.47, -2.0);
result = pow (0.0, 0.0);
result = pow (22.3, 1.0);
result = pow (33.2, -1.0);
return 0;
}
/* { dg-final { scan-assembler-not "pow" } } */
/* { dg-do run } */
/* { dg-options "-O2 -ffast-math -fno-inline -fno-unroll-loops -lm" } */
#include <math.h>
extern void abort (void);
#define NVALS 6
static double
convert_it (double x)
{
return pow (x, 0.5);
}
int
main (int argc, char *argv[])
{
double values[NVALS] = { 3.0, 1.95, 2.227, 4.0, 256.0, .0008797 };
double PREC = 0.999999;
unsigned i;
for (i = 0; i < NVALS; i++)
if (fabs (convert_it (values[i]) / sqrt (values[i])) < PREC)
abort ();
return 0;
}
/* { dg-do compile } */
/* { dg-options "-O2 -ffast-math -fno-inline -fno-unroll-loops -lm -mpowerpc-gpopt" } */
#include <math.h>
extern void abort (void);
#define NVALS 6
static double
convert_it (double x)
{
return pow (x, 0.5);
}
int
main (int argc, char *argv[])
{
double values[NVALS] = { 3.0, 1.95, 2.227, 4.0, 256.0, .0008797 };
unsigned i;
for (i = 0; i < NVALS; i++)
if (convert_it (values[i]) != sqrt (values[i]))
abort ();
return 0;
}
/* { dg-final { scan-assembler-times "fsqrt" 2 { target powerpc*-*-* } } } */
/* { dg-final { scan-assembler-not "pow" { target powerpc*-*-* } } } */
/* { dg-do run } */
/* { dg-options "-O2 -ffast-math -fno-inline -fno-unroll-loops -lm -mpowerpc-gpopt" } */
#include <math.h>
extern void abort (void);
#define NVALS 6
static double
convert_it (double x)
{
return pow (x, 0.25);
}
int
main (int argc, char *argv[])
{
double values[NVALS] = { 3.0, 1.95, 2.227, 4.0, 256.0, .0008797 };
unsigned i;
for (i = 0; i < NVALS; i++)
if (convert_it (values[i]) != sqrt (sqrt (values[i])))
abort ();
return 0;
}
/* { dg-do run } */
/* { dg-options "-O2 -ffast-math -fno-inline -fno-unroll-loops -lm -mpowerpc-gpopt" } */
#include <math.h>
extern void abort (void);
#define NVALS 6
static double
convert_it (double x)
{
return pow (x, 0.75);
}
int
main (int argc, char *argv[])
{
double values[NVALS] = { 3.0, 1.95, 2.227, 4.0, 256.0, .0008797 };
double PREC = 0.999999;
unsigned i;
for (i = 0; i < NVALS; i++)
{
volatile double x, y;
x = sqrt (values[i]);
y = sqrt (sqrt (values[i]));
if (fabs (convert_it (values[i]) / (x * y)) < PREC)
abort ();
}
return 0;
}
/* { dg-do run } */
/* { dg-options "-O2 -ffast-math -fno-inline -fno-unroll-loops -lm -mpowerpc-gpopt" } */
#include <math.h>
extern void abort (void);
#define NVALS 6
static double
convert_it (double x)
{
return pow (x, 1.0 / 6.0);
}
int
main (int argc, char *argv[])
{
double values[NVALS] = { 3.0, 1.95, 2.227, 729.0, 64.0, .0008797 };
unsigned i;
for (i = 0; i < NVALS; i++)
if (convert_it (values[i]) != cbrt (sqrt (values[i])))
abort ();
return 0;
}
/* { dg-do run } */
/* { dg-options "-O2 -ffast-math -fno-inline -fno-unroll-loops -lm -mpowerpc-gpopt" } */
#include <math.h>
extern void abort (void);
#define NVALS 6
static double
convert_it_1 (double x)
{
return pow (x, 1.5);
}
static double
convert_it_2 (double x)
{
return pow (x, 2.5);
}
static double
convert_it_3 (double x)
{
return pow (x, -0.5);
}
static double
convert_it_4 (double x)
{
return pow (x, 10.5);
}
static double
convert_it_5 (double x)
{
return pow (x, -3.5);
}
int
main (int argc, char *argv[])
{
double values[NVALS] = { 3.0, 1.95, 2.227, 4.0, 256.0, .0008797 };
double PREC = .999999;
unsigned i;
for (i = 0; i < NVALS; i++)
{
volatile double x, y;
x = sqrt (values[i]);
y = __builtin_powi (values[i], 1);
if (fabs (convert_it_1 (values[i]) / (x * y)) < PREC)
abort ();
x = sqrt (values[i]);
y = __builtin_powi (values[i], 2);
if (fabs (convert_it_2 (values[i]) / (x * y)) < PREC)
abort ();
x = sqrt (values[i]);
y = __builtin_powi (values[i], -1);
if (fabs (convert_it_3 (values[i]) / (x * y)) < PREC)
abort ();
x = sqrt (values[i]);
y = __builtin_powi (values[i], 10);
if (fabs (convert_it_4 (values[i]) / (x * y)) < PREC)
abort ();
x = sqrt (values[i]);
y = __builtin_powi (values[i], -4);
if (fabs (convert_it_5 (values[i]) / (x * y)) < PREC)
abort ();
}
return 0;
}
/* { dg-do run } */
/* { dg-options "-O2 -ffast-math -fno-inline -fno-unroll-loops -lm -mpowerpc-gpopt" } */
#include <math.h>
extern void abort (void);
#define NVALS 6
static double
convert_it_1 (double x)
{
return pow (x, 10.0 / 3.0);
}
static double
convert_it_2 (double x)
{
return pow (x, 11.0 / 3.0);
}
static double
convert_it_3 (double x)
{
return pow (x, -7.0 / 3.0);
}
static double
convert_it_4 (double x)
{
return pow (x, -8.0 / 3.0);
}
int
main (int argc, char *argv[])
{
double values[NVALS] = { 3.0, 1.95, 2.227, 4.0, 256.0, .0008797 };
double PREC = .999999;
unsigned i;
for (i = 0; i < NVALS; i++)
{
volatile double x, y;
x = __builtin_powi (values[i], 3);
y = __builtin_powi (cbrt (values[i]), 1);
if (fabs (convert_it_1 (values[i]) / (x * y)) < PREC)
abort ();
x = __builtin_powi (values[i], 3);
y = __builtin_powi (cbrt (values[i]), 2);
if (fabs (convert_it_2 (values[i]) / (x * y)) < PREC)
abort ();
x = __builtin_powi (values[i], -3);
y = __builtin_powi (cbrt (values[i]), 2);
if (fabs (convert_it_3 (values[i]) / (x * y)) < PREC)
abort ();
x = __builtin_powi (values[i], -3);
y = __builtin_powi (cbrt (values[i]), 1);
if (fabs (convert_it_4 (values[i]) / (x * y)) < PREC)
abort ();
}
return 0;
}
/* { dg-do compile } */
/* { dg-options "-O2 -ffast-math -mcpu=power6" } */
double foo (double x, double y)
{
return __builtin_pow (x, 0.75) + y;
}
/* { dg-final { scan-assembler "fmadd" { target powerpc*-*-* } } } */
/* { dg-do compile } */
/* { dg-options "-O2 -ffast-math -fno-inline -fno-unroll-loops -lm -mpowerpc-gpopt" } */
#include <math.h>
extern void abort (void);
#define NVALS 6
static double
convert_it (double x)
{
return pow (x, 0.25);
}
int
main (int argc, char *argv[])
{
double values[NVALS] = { 3.0, 1.95, 2.227, 4.0, 256.0, .0008797 };
unsigned i;
for (i = 0; i < NVALS; i++)
if (convert_it (values[i]) != sqrt (sqrt (values[i])))
abort ();
return 0;
}
/* { dg-final { scan-assembler-times "fsqrt" 4 { target powerpc*-*-* } } } */
/* { dg-final { scan-assembler-not "pow" { target powerpc*-*-* } } } */
/* { dg-do compile } */
/* { dg-options "-O2 -ffast-math -fno-inline -fno-unroll-loops -lm -mpowerpc-gpopt" } */
#include <math.h>
extern void abort (void);
#define NVALS 6
static double
convert_it (double x)
{
return pow (x, 0.75);
}
int
main (int argc, char *argv[])
{
double values[NVALS] = { 3.0, 1.95, 2.227, 4.0, 256.0, .0008797 };
unsigned i;
for (i = 0; i < NVALS; i++)
if (convert_it (values[i]) != sqrt(values[i]) * sqrt (sqrt (values[i])))
abort ();
return 0;
}
/* { dg-final { scan-assembler-times "sqrt" 4 { target powerpc*-*-* } } } */
/* { dg-final { scan-assembler-not "pow" { target powerpc*-*-* } } } */
/* { dg-do compile } */
/* { dg-options "-O2 -ffast-math -fno-inline -fno-unroll-loops -lm -mpowerpc-gpopt" } */
#include <math.h>
extern void abort (void);
#define NVALS 6
static double
convert_it (double x)
{
return pow (x, 1.0 / 3.0);
}
int
main (int argc, char *argv[])
{
double values[NVALS] = { 3.0, 1.95, 2.227, 729.0, 64.0, .0008797 };
unsigned i;
for (i = 0; i < NVALS; i++)
if (convert_it (values[i]) != cbrt (values[i]))
abort ();
return 0;
}
/* { dg-final { scan-assembler-times "cbrt" 2 { target powerpc*-*-* } } } */
/* { dg-final { scan-assembler-not "pow" { target powerpc*-*-* } } } */
/* { dg-do compile } */
/* { dg-options "-O2 -ffast-math -fno-inline -fno-unroll-loops -lm -mpowerpc-gpopt" } */
#include <math.h>
extern void abort (void);
#define NVALS 6
static double
convert_it (double x)
{
return pow (x, 1.0 / 6.0);
}
int
main (int argc, char *argv[])
{
double values[NVALS] = { 3.0, 1.95, 2.227, 729.0, 64.0, .0008797 };
unsigned i;
for (i = 0; i < NVALS; i++)
if (convert_it (values[i]) != cbrt (sqrt (values[i])))
abort ();
return 0;
}
/* { dg-final { scan-assembler-times "cbrt" 2 { target powerpc*-*-* } } } */
/* { dg-final { scan-assembler-not " pow " { target powerpc*-*-* } } } */
/* { dg-do compile } */
/* { dg-options "-O2 -ffast-math -fno-inline -fno-unroll-loops -lm -mpowerpc-gpopt" } */
#include <math.h>
extern void abort (void);
#define NVALS 6
static double
convert_it_1 (double x)
{
return pow (x, 1.5);
}
static double
convert_it_2 (double x)
{
return pow (x, 2.5);
}
static double
convert_it_3 (double x)
{
return pow (x, -0.5);
}
static double
convert_it_4 (double x)
{
return pow (x, 10.5);
}
int
main (int argc, char *argv[])
{
double values[NVALS] = { 3.0, 1.95, 2.227, 4.0, 256.0, .0008797 };
unsigned i;
for (i = 0; i < NVALS; i++)
{
if (convert_it_1 (values[i]) != sqrt (values[i]) * __builtin_powi (values[i], 1))
abort ();
if (convert_it_2 (values[i]) != sqrt (values[i]) * __builtin_powi (values[i], 2))
abort ();
if (convert_it_3 (values[i]) != sqrt (values[i]) * __builtin_powi (values[i], -1))
abort ();
if (convert_it_4 (values[i]) != sqrt (values[i]) * __builtin_powi (values[i], 10))
abort ();
}
return 0;
}
/* { dg-final { scan-assembler-times "sqrt" 5 { target powerpc*-*-* } } } */
/* { dg-final { scan-assembler-not "pow" { target powerpc*-*-* } } } */
/* { dg-do compile } */
/* { dg-options "-O2 -ffast-math -fno-inline -fno-unroll-loops -lm -mpowerpc-gpopt" } */
#include <math.h>
extern void abort (void);
#define NVALS 6
static double
convert_it_1 (double x)
{
return pow (x, 10.0 / 3.0);
}
static double
convert_it_2 (double x)
{
return pow (x, 11.0 / 3.0);
}
static double
convert_it_3 (double x)
{
return pow (x, -7.0 / 3.0);
}
static double
convert_it_4 (double x)
{
return pow (x, -8.0 / 3.0);
}
int
main (int argc, char *argv[])
{
double values[NVALS] = { 3.0, 1.95, 2.227, 4.0, 256.0, .0008797 };
unsigned i;
for (i = 0; i < NVALS; i++)
{
if (convert_it_1 (values[i]) !=
__builtin_powi (values[i], 3) * __builtin_powi (cbrt (values[i]), 1))
abort ();
if (convert_it_2 (values[i]) !=
__builtin_powi (values[i], 3) * __builtin_powi (cbrt (values[i]), 2))
abort ();
if (convert_it_3 (values[i]) !=
__builtin_powi (values[i], -3) * __builtin_powi (cbrt (values[i]), 2))
abort ();
if (convert_it_4 (values[i]) !=
__builtin_powi (values[i], -3) * __builtin_powi (cbrt (values[i]), 1))
abort ();
}
return 0;
}
/* { dg-final { scan-assembler-times "cbrt" 5 { target powerpc*-*-* } } } */
/* { dg-final { scan-assembler-not "pow" { target powerpc*-*-* } } } */
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