File: bb-slp-pattern-2.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 (53 lines) | stat: -rw-r--r-- 1,007 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
44
45
46
47
48
49
50
51
52
53
/* { dg-require-effective-target vect_condition } */
/* { dg-additional-options "-fno-tree-vectorize -ftree-slp-vectorize -ftree-loop-if-convert" } */

#include "tree-vect.h"

#define N 128

__attribute__((noinline, noclone)) void
foo (short * __restrict__ a, int * __restrict__ b, int stride)
{
  int i;

  for (i = 0; i < N/stride; i++, a += stride, b += stride)
   {
     a[0] = b[0] ? 1 : 7;
     a[1] = b[1] ? 2 : 7;
     a[2] = b[2] ? 3 : 0;
     a[3] = b[3] ? 4 : 7;
     a[4] = b[4] ? 5 : 0;
     a[5] = b[5] ? 6 : 0;
     a[6] = b[6] ? 7 : 0;
     a[7] = b[7] ? 8 : 7;
   }
}

short a[N];
int b[N];
int main ()
{
  int i;

  check_vect ();

  for (i = 0; i < N; i++)
    {
      a[i] = i;
      b[i] = -i;
    }

  foo (a, b, 8);

#pragma GCC novector
  for (i = 1; i < N; i++)
    if (a[i] != i%8 + 1)
      abort ();

  if (a[0] != 7)
    abort ();

  return 0;
}

/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp1" { target { vect_element_align && vect_pack_trunc } } } } */