summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/ppc-pow.c
blob: 1255d5c5966ffaef4f6930580de147bc6bc72d38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* { dg-do compile { target { { powerpc*-*-* } && { ! powerpc*-apple-darwin* } } } } */
/* { dg-options "-O2 -ffast-math -mcpu=power6" } */
/* { dg-final { scan-assembler-times "fsqrt" 3 } } */
/* { dg-final { scan-assembler-times "fmul" 1 } } */
/* { dg-final { scan-assembler-times "bl pow" 1 } } */
/* { dg-final { scan-assembler-times "bl sqrt" 1 } } */

double
do_pow_0_75_default (double a)
{
  return __builtin_pow (a, 0.75);	/* should generate 2 fsqrts */
}

double
do_pow_0_5_default (double a)
{
  return __builtin_pow (a, 0.5);	/* should generate fsqrt */
}

#pragma GCC target "no-powerpc-gpopt,no-powerpc-gfxopt"

double
do_pow_0_75_nosqrt (double a)
{
  return __builtin_pow (a, 0.75);	/* should call pow */
}

double
do_pow_0_5_nosqrt (double a)
{
  return __builtin_pow (a, 0.5);	/* should call sqrt */
}

#pragma GCC reset_options