aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/i386/pr61403.c
blob: 84cc5c5c80a211b4852cc9162f7e3268b8bc38a2 (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
/* { dg-do compile } */
/* { dg-require-effective-target sse4 } */
/* { dg-options "-O2 -ffast-math -ftree-vectorize -msse4.2 -mtune=corei7" } */

#include <math.h>

struct XYZ
{
  float x;
  float y;
  float z;
};

void
norm (struct XYZ *in, struct XYZ *out, int size)
{
  int i;
  for (i = 0; i < size; ++i)
    {
      float n = sqrt (in[i].x * in[i].x + in[i].y * in[i].y + in[i].z * in[i].z);
      out[i].x = in[i].x / n;
      out[i].y = in[i].y / n;
      out[i].z = in[i].z / n;
    }
}

/* { dg-final { scan-assembler "blend" } } */