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