File: pr68128-1.c

package info (click to toggle)
gcc-riscv64-unknown-elf 8.3.0.2019.08%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 680,956 kB
  • sloc: ansic: 3,237,715; cpp: 896,882; ada: 772,854; f90: 144,254; asm: 68,788; makefile: 67,456; sh: 29,743; exp: 28,045; objc: 15,273; fortran: 11,885; python: 7,369; pascal: 5,375; awk: 3,725; perl: 2,872; yacc: 316; xml: 311; ml: 285; lex: 198; haskell: 122
file content (32 lines) | stat: -rw-r--r-- 951 bytes parent folder | download | duplicates (4)
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
28
29
30
31
32
/* PR tree-optimization/68128 */
/* { dg-do compile } */
/* { dg-options "-Ofast -fopenmp -fdump-tree-vect-details" } */
/* { dg-additional-options "-mavx" { target i?86-*-* x86_64-*-* } } */

/* Make sure the following loop is vectorized even when not using
   firstprivate variables for scalar vars that are not modified
   in the parallel region.  */

void
foo (float *u, float v, float w, float x, float y, float z, float t)
{
  int i, j, k, l;
  float a, *b, c, s, e;
#pragma omp parallel for private (i, j, k, l, a, b, c, s, e)
  for (j = 0; j < 1024; j++)
    {
      k = j * 64;
      l = j * 64 + 63;
      a = v + j * w;
      b = u + j * 64;
      for (i = k; i <= l; i++, b++, a += w)
	{
	  c = a * a + y;
	  s = (1.f - c * x) * (1.f - c * x);
	  e = t * (1 / __builtin_sqrtf (c)) * s;
	  *b += (c < z ? e : 0);
	}
    }
}

/* { dg-final { scan-tree-dump "note: vectorized 1 loops in function" "vect" { target i?86-*-* x86_64-*-* } } } */