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_VALUE(I) ((I) * 11 / 2)
22 #define ADD_TEST(TYPE) \
23 TYPE a_##TYPE[N * 2]; \
24 TYPE __attribute__((noinline, noclone)) \
25 test_##TYPE (int x, int y) \
28 for (int i = 0; i < N; ++i) \
30 a_##TYPE[i + x] = i; \
31 res += a_##TYPE[i + y]; \
36 #define DO_TEST(TYPE) \
37 _Pragma("GCC novector") \
38 for (int i = 0; i < DIST * 2; ++i) \
40 for (int j = 0; j < N + DIST * 2; ++j) \
41 a_##TYPE[j] = TEST_VALUE (j); \
42 TYPE res = test_##TYPE (DIST, i); \
43 _Pragma("GCC novector") \
44 for (int j = 0; j < N; ++j) \
45 if (a_##TYPE[j + DIST] != (TYPE) j) \
47 TYPE expected_res = 0; \
48 for (int j = i; j < i + N; ++j) \
49 if (i <= DIST && j >= DIST && j < DIST + N) \
50 expected_res += j - DIST; \
52 expected_res += TEST_VALUE (j); \
53 if (expected_res != res) \
57 FOR_EACH_TYPE (ADD_TEST
)
62 FOR_EACH_TYPE (DO_TEST
)
66 /* { dg-final { scan-tree-dump {flags: *RAW\n} "vect" { target vect_int } } } */
67 /* { dg-final { scan-tree-dump "using an index-based overlap test" "vect" } } */
68 /* { dg-final { scan-tree-dump-not "using an address-based" "vect" } } */