1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ffast-math -ftree-vectorize -msse4.2 -mtune=corei7" } */
3 /* { dg-require-effective-target c99_runtime } */
4 
5 #include <math.h>
6 
7 struct XYZ
8 {
9   float x;
10   float y;
11   float z;
12 };
13 
14 void
norm(struct XYZ * in,struct XYZ * out,int size)15 norm (struct XYZ *in, struct XYZ *out, int size)
16 {
17   int i;
18   for (i = 0; i < size; ++i)
19     {
20       float n = sqrt (in[i].x * in[i].x + in[i].y * in[i].y + in[i].z * in[i].z);
21       out[i].x = in[i].x / n;
22       out[i].y = in[i].y / n;
23       out[i].z = in[i].z / n;
24     }
25 }
26 
27 /* { dg-final { scan-assembler "rsqrtps" } } */
28