File: pr57741-3.c

package info (click to toggle)
gcc-arm-none-eabi 15%3A14.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,099,328 kB
  • sloc: cpp: 3,627,108; ansic: 2,571,498; ada: 834,230; f90: 235,082; makefile: 79,231; asm: 74,984; xml: 51,692; exp: 39,736; sh: 33,298; objc: 15,629; python: 15,069; fortran: 14,429; pascal: 7,003; awk: 5,070; perl: 3,106; ml: 285; lisp: 253; lex: 204; haskell: 135
file content (43 lines) | stat: -rw-r--r-- 901 bytes parent folder | download
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
33
34
35
36
37
38
39
40
41
42
43
/* PR tree-optimization/57741 */
/* { dg-require-effective-target vect_float } */
/* { dg-require-effective-target vect_int } */
/* { dg-additional-options "-ffast-math" } */

#include "tree-vect.h"

extern void abort (void);

float p[1024] __attribute__((aligned (32))) = { 17.0f };
float q[1024] __attribute__((aligned (32))) = { 17.0f };
char r[1024] __attribute__((aligned (32))) = { 1 };

__attribute__((noinline, noclone)) void
foo (float x)
{
  int i;
  float f = 1.0f, g = 2.0f;
  for (i = 0; i < 1024; i++)
    {
      p[i] = f;
      f += x;
      q[i] = g;
      g += 0.5f;
      r[i]++;
    }
}

int
main ()
{
  int i;
  check_vect ();
  r[0] = 0;
  foo (1.5f);
#pragma GCC novector
  for (i = 0; i < 1024; i++)
    if (p[i] != 1.0f + i * 1.5f || q[i] != 2.0f + i * 0.5f || r[i] != 1)
      abort ();
  return 0;
}

/* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" } } */