Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/vect/pr87288-3.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 #include "tree-vect.h" | |
2 | |
3 #define N (VECTOR_BITS / 32) | |
4 #define MAX_COUNT 4 | |
5 | |
6 #define RUN_COUNT(COUNT) \ | |
7 void __attribute__ ((noipa)) \ | |
8 run_##COUNT (int *restrict a, int *restrict b) \ | |
9 { \ | |
10 for (int i = 0; i < N * COUNT + 1; ++i) \ | |
11 { \ | |
12 a[i * 2] = b[i * 2] + COUNT; \ | |
13 a[i * 2 + 1] = COUNT; \ | |
14 } \ | |
15 } | |
16 | |
17 RUN_COUNT (1) | |
18 RUN_COUNT (2) | |
19 RUN_COUNT (3) | |
20 RUN_COUNT (4) | |
21 | |
22 void __attribute__ ((noipa)) | |
23 check (int *restrict a, int count) | |
24 { | |
25 for (int i = 0; i < count * N + 1; ++i) | |
26 if (a[i * 2] != i * 41 + count || a[i * 2 + 1] != count) | |
27 __builtin_abort (); | |
28 if (a[count * 2 * N + 2] != 999) | |
29 __builtin_abort (); | |
30 } | |
31 | |
32 int a[N * MAX_COUNT * 2 + 3], b[N * MAX_COUNT * 2 + 2]; | |
33 | |
34 int | |
35 main (void) | |
36 { | |
37 check_vect (); | |
38 | |
39 for (int i = 0; i < N * MAX_COUNT + 1; ++i) | |
40 { | |
41 b[i * 2] = i * 41; | |
42 asm volatile ("" ::: "memory"); | |
43 } | |
44 | |
45 a[N * 2 + 2] = 999; | |
46 run_1 (a, b); | |
47 check (a, 1); | |
48 | |
49 a[N * 4 + 2] = 999; | |
50 run_2 (a, b); | |
51 check (a, 2); | |
52 | |
53 a[N * 6 + 2] = 999; | |
54 run_3 (a, b); | |
55 check (a, 3); | |
56 | |
57 a[N * 8 + 2] = 999; | |
58 run_4 (a, b); | |
59 check (a, 4); | |
60 | |
61 return 0; | |
62 } | |
63 | |
64 /* { dg-final { scan-tree-dump {LOOP VECTORIZED} "vect" { target { { vect_int && vect_perm } && vect_element_align } } } } */ |