1 /* { dg-do compile } */
2
3 extern "C" double pow(double, double);
4 template <typename T>
pow(T x,unsigned int n)5 T pow(T x, unsigned int n)
6 {
7 if (!n)
8 return 1;
9
10 T y = 1;
11 while (n > 1)
12 {
13 if (n%2)
14 y *= x;
15 x = x*x;
16 n /= 2;
17 }
18 return x*y;
19 }
20
testVec(int * x)21 void testVec(int* x)
22 {
23 for (int i = 0; i < 8; ++i)
24 x[i] = pow(x[i], 10);
25 }
26
27 /* { dg-final { scan-tree-dump "OUTER LOOP VECTORIZED" "vect" { target { vect_double && vect_hw_misalign } } } } */
28