Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / pr71805.c
blob02db059dff9327d67fcd8dc59f8479d56eeb362e
1 /* { dg-require-effective-target p9vector_hw } */
2 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
3 /* { dg-options "-mcpu=power9 -O3 --param tree-reassoc-width=1" } */
5 /* Originally from gcc.dg/vect/pr45752.c. */
6 #include <stdarg.h>
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 extern void abort (void);
12 extern void exit (int);
13 #ifdef __cplusplus
15 #endif
17 #define M00 100
18 #define M10 216
19 #define M20 23
20 #define M30 237
21 #define M40 437
23 #define M01 1322
24 #define M11 13
25 #define M21 27271
26 #define M31 2280
27 #define M41 284
29 #define M02 74
30 #define M12 191
31 #define M22 500
32 #define M32 111
33 #define M42 1114
35 #define M03 134
36 #define M13 117
37 #define M23 11
38 #define M33 771
39 #define M43 71
41 #define M04 334
42 #define M14 147
43 #define M24 115
44 #define M34 7716
45 #define M44 16
47 #define N 20
49 void foo (unsigned int *__restrict__ pInput,
50 unsigned int *__restrict__ pOutput,
51 unsigned int *__restrict__ pInput2,
52 unsigned int *__restrict__ pOutput2)
54 unsigned int i, a, b, c, d, e;
56 for (i = 0; i < N / 5; i++)
58 a = *pInput++;
59 b = *pInput++;
60 c = *pInput++;
61 d = *pInput++;
62 e = *pInput++;
64 *pOutput++ = M00 * a + M01 * b + M02 * c + M03 * d + M04 * e;
65 *pOutput++ = M10 * a + M11 * b + M12 * c + M13 * d + M14 * e;
66 *pOutput++ = M20 * a + M21 * b + M22 * c + M23 * d + M24 * e;
67 *pOutput++ = M30 * a + M31 * b + M32 * c + M33 * d + M34 * e;
68 *pOutput++ = M40 * a + M41 * b + M42 * c + M43 * d + M44 * e;
71 a = *pInput2++;
72 b = *pInput2++;
73 c = *pInput2++;
74 d = *pInput2++;
75 e = *pInput2++;
77 *pOutput2++ = M00 * a + M01 * b + M02 * c + M03 * d + M04 * e;
78 *pOutput2++ = M10 * a + M11 * b + M12 * c + M13 * d + M14 * e;
79 *pOutput2++ = M20 * a + M21 * b + M22 * c + M23 * d + M24 * e;
80 *pOutput2++ = M30 * a + M31 * b + M32 * c + M33 * d + M34 * e;
81 *pOutput2++ = M40 * a + M41 * b + M42 * c + M43 * d + M44 * e;
86 int main (int argc, const char* argv[])
88 unsigned int input[N], output[N], i, input2[N], output2[N];
89 unsigned int check_results[N]
90 = {3208, 1334, 28764, 35679, 2789, 13028, 4754, 168364, 91254, 12399,
91 22848, 8174, 307964, 146829, 22009, 32668, 11594, 447564, 202404, 31619 };
92 unsigned int check_results2[N]
93 = {7136, 2702, 84604, 57909, 6633, 16956, 6122, 224204, 113484, 16243,
94 26776, 9542, 363804, 169059, 25853, 36596, 12962, 503404, 224634, 35463 };
96 for (i = 0; i < N; i++)
98 input[i] = i%256;
99 input2[i] = i + 2;
100 output[i] = 0;
101 output2[i] = 0;
102 __asm__ volatile ("");
105 foo (input, output, input2, output2);
107 for (i = 0; i < N; i++)
108 if (output[i] != check_results[i]
109 || output2[i] != check_results2[i])
110 abort ();
112 return 0;