6 typedef signed char sc
;
7 typedef unsigned char uc
;
8 typedef signed short ss
;
9 typedef unsigned short us
;
11 typedef unsigned int ui
;
12 typedef signed long long sll
;
13 typedef unsigned long long ull
;
15 #define FOR_EACH_TYPE(M) \
22 #define TEST_VALUE1(I) ((I) * 5 / 2)
23 #define TEST_VALUE2(I) ((I) * 11 / 5)
25 #define ADD_TEST(TYPE) \
26 void __attribute__((noinline, noclone)) \
27 test_##TYPE (TYPE *restrict a, TYPE *restrict b, \
30 for (int i = 0; i < N; ++i) \
32 TYPE r1 = a[i * step + 0] += 1; \
33 a[i * step + 1] += 2; \
34 a[i * step + 2] += 4; \
35 a[i * step + 3] += 8; \
40 void __attribute__((noinline, noclone)) \
41 ref_##TYPE (TYPE *restrict a, TYPE *restrict b, \
44 for (int i = 0; i < N; ++i) \
46 TYPE r1 = a[i * step + 0] += 1; \
47 a[i * step + 1] += 2; \
48 a[i * step + 2] += 4; \
49 a[i * step + 3] += 8; \
55 #define DO_TEST(TYPE) \
56 for (int j = -M; j <= M; ++j) \
58 TYPE a1[N * M], a2[N * M], b1[N], b2[N]; \
59 for (int i = 0; i < N * M; ++i) \
60 a1[i] = a2[i] = TEST_VALUE1 (i); \
61 for (int i = 0; i < N; ++i) \
62 b1[i] = b2[i] = TEST_VALUE2 (i); \
63 int offset = (j < 0 ? N * M - 4 : 0); \
64 test_##TYPE (a1 + offset, b1, j); \
65 ref_##TYPE (a2 + offset, b2, j); \
66 if (__builtin_memcmp (a1, a2, sizeof (a1)) != 0) \
68 if (__builtin_memcmp (b1, b2, sizeof (b1)) != 0) \
72 FOR_EACH_TYPE (ADD_TEST
)
77 FOR_EACH_TYPE (DO_TEST
)
81 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* step[^ ]* is outside \(-2, 2\)} "vect" { target vect_int } } } */
82 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* step[^ ]* is outside \(-3, 3\)} "vect" { target vect_int } } } */
83 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* step[^ ]* is outside \(-4, 4\)} "vect" { target vect_int } } } */
84 /* { dg-final { scan-tree-dump {run-time check [^\n]* abs \([^*]*\) >= 4} "vect" { target vect_int } } } */
86 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* step[^ ]* \* 2[)]* is outside \(-4, 4\)} "vect" { target vect_int } } } */
87 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* step[^ ]* \* 2[)]* is outside \(-6, 6\)} "vect" { target vect_int } } } */
88 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* step[^ ]* \* 2[)]* is outside \(-8, 8\)} "vect" { target vect_int } } } */
89 /* { dg-final { scan-tree-dump {run-time check [^\n]* abs \([^*]* \* 2[)]* >= 8} "vect" { target vect_int } } } */
91 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* step[^ ]* \* 4[)]* is outside \(-8, 8\)} "vect" { target { vect_int || vect_float } } } } */
92 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* step[^ ]* \* 4[)]* is outside \(-12, 12\)} "vect" { target { vect_int || vect_float } } } } */
93 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* step[^ ]* \* 4[)]* is outside \(-16, 16\)} "vect" { target { vect_int || vect_float } } } } */
94 /* { dg-final { scan-tree-dump {run-time check [^\n]* abs \([^*]* \* 4[)]* >= 16} "vect" { target { vect_int || vect_float } } } } */
96 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* step[^ ]* \* 8[)]* is outside \(-16, 16\)} "vect" { target vect_double } } } */
97 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* step[^ ]* \* 8[)]* is outside \(-24, 24\)} "vect" { target vect_double } } } */
98 /* { dg-final { scan-tree-dump {no alias between [^\n]* when [^\n]* step[^ ]* \* 8[)]* is outside \(-32, 32\)} "vect" { target vect_double } } } */
99 /* { dg-final { scan-tree-dump {run-time check [^\n]* abs \([^*]* \* 8[)]* >= 32} "vect" { target vect_double } } } */