Debian Codegraph @

gcc/testsuite/gcc.dg/vect/bb-slp-pr54400.c

raw
1 /* { dg-require-effective-target vect_float } */
2 /* { dg-additional-options "-w -Wno-psabi -ffast-math" } */
3
4 #include "tree-vect.h"
5
6 typedef float v4sf __attribute__((vector_size(sizeof(float)*4)));
7
8 float __attribute__((noipa))
9 f(v4sf v)
10 {
11 return v[0]+v[1]+v[2]+v[3];
12 }
13
14 float __attribute__((noipa))
15 g(float *v)
16 {
17 return v[0]+v[1]+v[2]+v[3];
18 }
19
20 float __attribute__((noipa))
21 h(float *v)
22 {
23 return 2*v[0]+3*v[1]+4*v[2]+5*v[3];
24 }
25
26 int
27 main ()
28 {
29 check_vect ();
30 v4sf v = (v4sf) { 1.f, 3.f, 4.f, 2.f };
31 if (f (v) != 10.f)
32 abort ();
33 if (g (&v[0]) != 10.f)
34 abort ();
35 if (h (&v[0]) != 37.f)
36 abort ();
37 return 0;
38 }
39
40 /* We are lacking an effective target for .REDUC_PLUS support. */
41 /* { dg-final { scan-tree-dump-times "basic block part vectorized" 3 "slp2" { target x86_64-*-* aarch64*-*-* } } } */
42 /* { dg-final { scan-tree-dump-not " = VEC_PERM_EXPR" "slp2" { target x86_64-*-* aarch64*-*-* } } } */