re PR tree-optimization/84687 (error: invalid conversion in gimple call with -O3 and -ffast-math)

PR tree-optimization/84687
	* omp-simd-clone.c (simd_clone_create): Clear DECL_BUILT_IN_CLASS
	on new_node->decl.
	* match.pd (pow(C,x)*expN(y) -> expN(logN(C)*x+y)): New optimization.

	* gcc.dg/pr84687.c: New test.

From-SVN: r258272
This commit is contained in:
Jakub Jelinek 2018-03-06 08:06:44 +01:00 committed by Jakub Jelinek
parent 23d63b459c
commit 16ef0a8cb7
5 changed files with 43 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2018-03-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/84687
* omp-simd-clone.c (simd_clone_create): Clear DECL_BUILT_IN_CLASS
on new_node->decl.
* match.pd (pow(C,x)*expN(y) -> expN(logN(C)*x+y)): New optimization.
2018-03-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
* config/rs6000/rs6000-builtin.def (rs6000_speculation_barrier):

View File

@ -4030,6 +4030,16 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(exps (mult (logs @0) @1))
(exp2s (mult (log2s @0) @1)))))))
/* pow(C,x)*expN(y) -> expN(logN(C)*x+y) if C > 0. */
(for pows (POW)
exps (EXP EXP2 EXP10 POW10)
logs (LOG LOG2 LOG10 LOG10)
(simplify
(mult:c (pows:s REAL_CST@0 @1) (exps:s @2))
(if (real_compare (GT_EXPR, TREE_REAL_CST_PTR (@0), &dconst0)
&& real_isfinite (TREE_REAL_CST_PTR (@0)))
(exps (plus (mult (logs @0) @1) @2)))))
(for sqrts (SQRT)
cbrts (CBRT)
pows (POW)

View File

@ -456,6 +456,8 @@ simd_clone_create (struct cgraph_node *old_node)
if (new_node == NULL)
return new_node;
DECL_BUILT_IN_CLASS (new_node->decl) = NOT_BUILT_IN;
DECL_FUNCTION_CODE (new_node->decl) = (enum built_in_function) 0;
TREE_PUBLIC (new_node->decl) = TREE_PUBLIC (old_node->decl);
DECL_COMDAT (new_node->decl) = DECL_COMDAT (old_node->decl);
DECL_WEAK (new_node->decl) = DECL_WEAK (old_node->decl);

View File

@ -1,3 +1,8 @@
2018-03-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/84687
* gcc.dg/pr84687.c: New test.
2018-03-06 Alexandre Oliva <aoliva@redhat.com>
PR c++/84231

View File

@ -0,0 +1,19 @@
/* PR tree-optimization/84687 */
/* { dg-do compile } */
/* { dg-options "-Ofast" } */
int a[64], b;
double pow (double, double);
__attribute__((__simd__)) double exp (double);
void
foo (double x)
{
int i;
double c = exp (x);
for (i = 0; i < 64; i++)
{
b = i;
a[i] = pow (12.0, b) * pow (c, i);
}
}