arm: fix typo in dg-require-effective-target [PR118089]
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / ldist-rawmemchr-2.c
blob6c8a485a3aa5ed72a1fd78f867c14b5e97cfd58c
1 /* { dg-do run { target { { s390x-*-* } || { riscv_v } } } } */
2 /* { dg-options "-O2 -ftree-loop-distribution -fdump-tree-ldist-details" } */
3 /* { dg-additional-options "-march=z13 -mzarch" { target s390x-*-* } } */
4 /* { dg-final { scan-tree-dump-times "generated rawmemchrQI" 2 "ldist" { target { { s390x-*-* } || { riscv_v } } } } } */
5 /* { dg-final { scan-tree-dump-times "generated rawmemchrHI" 2 "ldist" { target { { s390x-*-* } || { riscv_v } } } } } */
6 /* { dg-final { scan-tree-dump-times "generated rawmemchrSI" 2 "ldist" { target { { s390x-*-* } || { riscv_v } } } } } */
8 /* Rawmemchr pattern: reduction stmt and store */
10 #include <stdint.h>
11 #include <assert.h>
13 typedef __SIZE_TYPE__ size_t;
14 extern void* malloc (size_t);
15 extern void* memset (void*, int, size_t);
17 uint8_t *p_uint8_t;
18 uint16_t *p_uint16_t;
19 uint32_t *p_uint32_t;
21 int8_t *p_int8_t;
22 int16_t *p_int16_t;
23 int32_t *p_int32_t;
25 #define test(T, pattern) \
26 __attribute__((noinline)) \
27 T *test_##T (void) \
28 { \
29 while (*p_##T != pattern) \
30 ++p_##T; \
31 return p_##T; \
34 test (uint8_t, 0xab)
35 test (uint16_t, 0xabcd)
36 test (uint32_t, 0xabcdef15)
38 test (int8_t, (int8_t)0xab)
39 test (int16_t, (int16_t)0xabcd)
40 test (int32_t, (int32_t)0xabcdef15)
42 #define run(T, pattern, i) \
43 { \
44 T *q = p; \
45 q[i] = pattern; \
46 p_##T = p; \
47 T *r = test_##T (); \
48 assert (r == p_##T); \
49 assert (r == &q[i]); \
50 q[i] = 0; \
53 int main(void)
55 void *p = malloc (1024);
56 assert (p);
57 memset (p, '\0', 1024);
59 run (uint8_t, 0xab, 0);
60 run (uint8_t, 0xab, 1);
61 run (uint8_t, 0xab, 13);
63 run (uint16_t, 0xabcd, 0);
64 run (uint16_t, 0xabcd, 1);
65 run (uint16_t, 0xabcd, 13);
67 run (uint32_t, 0xabcdef15, 0);
68 run (uint32_t, 0xabcdef15, 1);
69 run (uint32_t, 0xabcdef15, 13);
71 run (int8_t, (int8_t)0xab, 0);
72 run (int8_t, (int8_t)0xab, 1);
73 run (int8_t, (int8_t)0xab, 13);
75 run (int16_t, (int16_t)0xabcd, 0);
76 run (int16_t, (int16_t)0xabcd, 1);
77 run (int16_t, (int16_t)0xabcd, 13);
79 run (int32_t, (int32_t)0xabcdef15, 0);
80 run (int32_t, (int32_t)0xabcdef15, 1);
81 run (int32_t, (int32_t)0xabcdef15, 13);
83 return 0;