4 typedef signed char sc
;
5 typedef unsigned char uc
;
6 typedef signed short ss
;
7 typedef unsigned short us
;
9 typedef unsigned int ui
;
10 typedef signed long long sll
;
11 typedef unsigned long long ull
;
13 #define FOR_EACH_TYPE(M) \
20 #define TEST_VALUE1(I) ((I) * 5 / 2)
21 #define TEST_VALUE2(I) ((I) * 11 / 5)
23 #define ADD_TEST(TYPE) \
24 void __attribute__((noinline, noclone)) \
25 test_##TYPE (TYPE *restrict a, TYPE *restrict b, \
29 for (int i = 0; i < N; ++i) \
31 TYPE r1 = a[i * step + 0] += 1; \
32 a[i * step + 1] += 2; \
33 a[i * step + 2] += 4; \
34 a[i * step + 3] += 8; \
39 void __attribute__((noinline, noclone)) \
40 ref_##TYPE (TYPE *restrict a, TYPE *restrict b, \
43 for (unsigned short i = 0; i < N; ++i) \
45 TYPE r1 = a[i * step + 0] += 1; \
46 a[i * step + 1] += 2; \
47 a[i * step + 2] += 4; \
48 a[i * step + 3] += 8; \
54 #define DO_TEST(TYPE) \
55 for (int j = 0; j <= M; ++j) \
57 TYPE a1[N * M], a2[N * M], b1[N], b2[N]; \
58 for (int i = 0; i < N * M; ++i) \
59 a1[i] = a2[i] = TEST_VALUE1 (i); \
60 for (int i = 0; i < N; ++i) \
61 b1[i] = b2[i] = TEST_VALUE2 (i); \
62 test_##TYPE (a1, b1, j); \
63 ref_##TYPE (a2, b2, j); \
64 if (__builtin_memcmp (a1, a2, sizeof (a1)) != 0) \
66 if (__builtin_memcmp (b1, b2, sizeof (b1)) != 0) \
70 FOR_EACH_TYPE (ADD_TEST
)
75 FOR_EACH_TYPE (DO_TEST
)
79 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* [_a-z][^ ]* is outside \[0, 2\)} "vect" { target vect_int } } } */
80 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* [_a-z][^ ]* is outside \[0, 3\)} "vect" { target vect_int } } } */
81 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* [_a-z][^ ]* is outside \[0, 4\)} "vect" { target vect_int } } } */
82 /* { dg-final { scan-tree-dump {run-time check [^\n]* unsigned \([^*]*\) >= 4} "vect" { target vect_int } } } */
84 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* [_a-z][^ ]* \* 2[)]* is outside \[0, 4\)} "vect" { target vect_int } } } */
85 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* [_a-z][^ ]* \* 2[)]* is outside \[0, 6\)} "vect" { target vect_int } } } */
86 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* [_a-z][^ ]* \* 2[)]* is outside \[0, 8\)} "vect" { target vect_int } } } */
87 /* { dg-final { scan-tree-dump {run-time check [^\n]* unsigned \([^*]* \* 2[)]* >= 8} "vect" { target vect_int } } } */
89 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* [_a-z][^ ]* \* 4[)]* is outside \[0, 8\)} "vect" { target { vect_int || vect_float } }} } */
90 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* [_a-z][^ ]* \* 4[)]* is outside \[0, 12\)} "vect" { target { vect_int || vect_float } }} } */
91 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* [_a-z][^ ]* \* 4[)]* is outside \[0, 16\)} "vect" { target { vect_int || vect_float } }} } */
92 /* { dg-final { scan-tree-dump {run-time check [^\n]* unsigned \([^*]* \* 4[)]* >= 16} "vect" { target { vect_int || vect_float } }} } */
94 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* [_a-z][^ ]* \* 8[)]* is outside \[0, 16\)} "vect" { target vect_double } } } */
95 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* [_a-z][^ ]* \* 8[)]* is outside \[0, 24\)} "vect" { target vect_double } } } */
96 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* [_a-z][^ ]* \* 8[)]* is outside \[0, 32\)} "vect" { target vect_double } } } */
97 /* { dg-final { scan-tree-dump {run-time check [^\n]* unsigned \([^*]* \* 8[)]* >= 32} "vect" { target vect_double } } } */