1 // { dg-do compile { target { i?86-*-* x86_64-*-* } && { ! *-*-solaris* } } }
2 // -fopenmp implies -pthread
3 // { dg-require-effective-target pthread }
4 // { dg-options "-Ofast -funroll-loops -fopenmp -march=knl" }
5 // Disabling epilogues until we find a better way to deal with scans.
6 // { dg-additional-options "--param vect-epilogues-nomask=0" }
11 #include <xmmintrin.h>
13 #define max(a, b) ( (a) > (b) ? (a) : (b) )
22 extern int N1, N2, N3;
24 #define func(p, up, down) ((p)*(up) + (1.0f-(p)) * (down))
26 void foo (Sdata *in, int idx, float *out)
28 float* y1 = (float*)_mm_malloc(sizeof(float) * N1,16);
29 float* y2 = (float*)_mm_malloc(sizeof(float) * N1,16);
30 float* y3 = (float*)_mm_malloc(sizeof(float) * N1,16);
31 float* y4 = (float*)_mm_malloc(sizeof(float) * N1,16);
33 for (int k = idx; k < idx + N3; k++) {
40 float u = exp(x4 * sqrt(x5));
41 float d = exp(-x4 * sqrt(x5));
42 float a = exp(x1 * x5);
43 float m = exp(-x1 * x5);
44 float p = (a - d) / (u - d);
47 for (int i = 1; i <= N2; i++) {
48 y2[i] = u * y2[i - 1];
49 y3[i] = d * y3[i - 1];
52 for (int i = 0; i <= N2; i++) {
54 max((x3 - y2[N2 - i] * y3[i]), float(0.f));
56 for (int i = N2 - 1; i >= 0; i--) {
58 for (int j = 0; j <= i; j++) {
59 y4[j] = func(p,y1[j],y1[j+1]) * m;
62 for (int j = 0; j <= i; j++) {
63 float t1 = y2[i - j] * y3[j];
64 float t2 = max(x3 - t1, float(0.f));
65 y1[j] = max(t2, y4[j]);
76 // { dg-final { scan-assembler-not "vmovaps\[^\n\r]*zmm\[0-9]+,\[^\n\r]*zmm\[0-9]+" } }