c++: wrong error due to std::initializer_list opt [PR116476]
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr88497-7.c
blobe94907b3426567cf9a14114135fdc57d8d644cff
1 /* { dg-require-effective-target avx512f_runtime } */
2 /* { dg-additional-options "-O2 -mavx512f -ffast-math -fdump-tree-reassoc1" } */
4 /* To test reassoc can undistribute vector bit_field_ref on multiple
5 vector machine modes, bypass those modes with only one candidate.
7 v1, v2 of type vector 4 x float
8 v3 of type vector 8 x float
9 v5, v6 of type vector 16 x float
11 reassoc transforms
13 accumulator += v1[0] + v1[1] + v1[2] + v1[3] +
14 v2[0] + v2[1] + v2[2] + v2[3] +
15 v3[0] + v3[1] + v3[2] + v3[3] +
16 v3[4] + v3[5] + v3[6] + v3[7] +
17 v5[0] + v5[1] + v5[2] + v5[3] +
18 v5[4] + v5[5] + v5[6] + v5[7] +
19 v5[8] + v5[9] + v5[10] + v5[11] +
20 v5[12] + v5[13] + v5[14] + v5[15] +
21 v6[0] + v6[1] + v6[2] + v6[3] +
22 v6[4] + v6[5] + v6[6] + v6[7] +
23 v6[8] + v6[9] + v6[10] + v6[11] +
24 v6[12] + v6[13] + v6[14] + v6[15] ;
26 into:
28 T12 = v1 + v2;
29 T56 = v5 + v6;
30 accumulator += T12[0] + T12[1] + T12[2] + T12[3] +
31 accumulator += v3[0] + v3[1] + v3[2] + v3[3] +
32 accumulator += v3[4] + v3[5] + v3[6] + v3[7] +
33 accumulator += T56[0] + T56[1] + T56[2] + T56[3] +
34 accumulator += T56[4] + T56[5] + T56[6] + T56[7] +
35 accumulator += T56[8] + T56[9] + T56[10] + T56[11] +
36 accumulator += T56[12] + T56[13] + T56[14] + T56[15] ; */
38 typedef float v4sf __attribute__((vector_size(16)));
39 typedef float v8sf __attribute__((vector_size(32)));
40 typedef float v16sf __attribute__((vector_size(64)));
42 __attribute__ ((noinline))
43 float test(float accumulator, v4sf v1, v4sf v2, v8sf v3, v16sf v5, v16sf v6) {
44 accumulator += v1[0] + v1[1] + v1[2] + v1[3];
45 accumulator += v2[0] + v2[1] + v2[2] + v2[3];
46 accumulator += v3[0] + v3[1] + v3[2] + v3[3];
47 accumulator += v3[4] + v3[5] + v3[6] + v3[7];
48 accumulator += v5[0] + v5[1] + v5[2] + v5[3];
49 accumulator += v5[4] + v5[5] + v5[6] + v5[7];
50 accumulator += v5[8] + v5[9] + v5[10] + v5[11];
51 accumulator += v5[12] + v5[13] + v5[14] + v5[15];
52 accumulator += v6[0] + v6[1] + v6[2] + v6[3];
53 accumulator += v6[4] + v6[5] + v6[6] + v6[7];
54 accumulator += v6[8] + v6[9] + v6[10] + v6[11];
55 accumulator += v6[12] + v6[13] + v6[14] + v6[15];
56 return accumulator;
59 extern void abort (void);
61 int
62 main ()
64 v4sf v1 = {1.0, 2.0, 3.0, 4.0 };
65 v4sf v2 = {5.0, 6.0, 7.0, 8.0 };
66 v8sf v3 = {9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 };
67 v16sf v5 = {17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, 31.0, 32.0};
68 v16sf v6 = {33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0};
69 float acc = 24.0;
70 double res = test (acc, v1, v2, v3, v5, v6);
71 if (res != 1200.0)
72 abort();
73 return 0;
76 /* { dg-final { scan-tree-dump-times "BIT_FIELD_REF" 28 "reassoc1" } } */