annotate gcc/testsuite/gcc.dg/vect/vect-reduc-9.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-require-effective-target vect_int } */
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 #include "tree-vect.h"
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 #define N 32
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 extern void abort (void);
kono
parents:
diff changeset
8 typedef unsigned short T;
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 __attribute__ ((noinline)) void
kono
parents:
diff changeset
11 testmax (const T *c, T init, T result)
kono
parents:
diff changeset
12 {
kono
parents:
diff changeset
13 T lc[N], accum = init;
kono
parents:
diff changeset
14 int i;
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 __builtin_memcpy (lc, c, sizeof(lc));
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 for (i = 0; i < N; i++) {
kono
parents:
diff changeset
19 accum = accum < lc[i] ? lc[i] : accum;
kono
parents:
diff changeset
20 }
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 if (accum != result)
kono
parents:
diff changeset
23 abort ();
kono
parents:
diff changeset
24 }
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 __attribute__ ((noinline)) void
kono
parents:
diff changeset
27 testmin (const T *c, T init, T result)
kono
parents:
diff changeset
28 {
kono
parents:
diff changeset
29 T lc[N], accum = init;
kono
parents:
diff changeset
30 int i;
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 __builtin_memcpy (lc, c, sizeof(lc));
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 for (i = 0; i < N; i++) {
kono
parents:
diff changeset
35 accum = accum > lc[i] ? lc[i] : accum;
kono
parents:
diff changeset
36 }
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 if (accum != result)
kono
parents:
diff changeset
39 abort ();
kono
parents:
diff changeset
40 }
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 int main (void)
kono
parents:
diff changeset
43 {
kono
parents:
diff changeset
44 static unsigned short const A[N] = {
kono
parents:
diff changeset
45 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008,
kono
parents:
diff changeset
46 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010,
kono
parents:
diff changeset
47 0x7000, 0x7100, 0x7200, 0x7300, 0x7400, 0x7500, 0x7600, 0x7700,
kono
parents:
diff changeset
48 0x7ff8, 0x7ff9, 0x7ffa, 0x7ffb, 0x7ffc, 0x7ffd, 0x7ffe, 0x7fff
kono
parents:
diff changeset
49 };
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 static unsigned short const B[N] = {
kono
parents:
diff changeset
52 0x7000, 0x7100, 0x7200, 0x7300, 0x7400, 0x7500, 0x7600, 0x7700,
kono
parents:
diff changeset
53 0x7ff8, 0x7ff9, 0x7ffa, 0x7ffb, 0x7ffc, 0x7ffd, 0x7ffe, 0x7fff,
kono
parents:
diff changeset
54 0x8000, 0x8001, 0x8002, 0x8003, 0x8004, 0x8005, 0x8006, 0x8007,
kono
parents:
diff changeset
55 0x8008, 0x8009, 0x800a, 0x800b, 0x800c, 0x800d, 0x800e, 0x800f
kono
parents:
diff changeset
56 };
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 static unsigned short const C[N] = {
kono
parents:
diff changeset
59 0xffff, 0xfffe, 0xfffd, 0xfffc, 0xfffb, 0xfffa, 0xfff9, 0xfff8,
kono
parents:
diff changeset
60 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010,
kono
parents:
diff changeset
61 0x8000, 0x8001, 0x8002, 0x8003, 0x8004, 0x8005, 0x8006, 0x8007,
kono
parents:
diff changeset
62 0x7000, 0x7100, 0x7200, 0x7300, 0x7400, 0x7500, 0x7600, 0x7700,
kono
parents:
diff changeset
63 };
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 check_vect ();
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 testmin (A, 10, 1);
kono
parents:
diff changeset
68 testmin (B, 0x7fff, 0x7000);
kono
parents:
diff changeset
69 testmin (C, 0x7fff, 0x0009);
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 testmax (A, 0, 0x7fff);
kono
parents:
diff changeset
72 testmax (B, 0, 0x800f);
kono
parents:
diff changeset
73 testmax (C, 0, 0xffff);
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 return 0;
kono
parents:
diff changeset
76 }
kono
parents:
diff changeset
77