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 no store */
13 typedef __SIZE_TYPE__
size_t;
14 extern void* malloc (size_t);
15 extern void* memset (void*, int, size_t);
17 #define test(T, pattern) \
18 __attribute__((noinline)) \
21 while (*p != (T)pattern) \
27 test (uint16_t, 0xabcd)
28 test (uint32_t, 0xabcdef15)
31 test (int16_t, 0xabcd)
32 test (int32_t, 0xabcdef15)
34 #define run(T, pattern, i) \
38 assert (test_##T (p) == &q[i]); \
44 void *p
= malloc (1024);
48 run (uint8_t, 0xab, 0);
49 run (uint8_t, 0xab, 1);
50 run (uint8_t, 0xab, 13);
52 run (uint16_t, 0xabcd, 0);
53 run (uint16_t, 0xabcd, 1);
54 run (uint16_t, 0xabcd, 13);
56 run (uint32_t, 0xabcdef15, 0);
57 run (uint32_t, 0xabcdef15, 1);
58 run (uint32_t, 0xabcdef15, 13);
60 run (int8_t, 0xab, 0);
61 run (int8_t, 0xab, 1);
62 run (int8_t, 0xab, 13);
64 run (int16_t, 0xabcd, 0);
65 run (int16_t, 0xabcd, 1);
66 run (int16_t, 0xabcd, 13);
68 run (int32_t, 0xabcdef15, 0);
69 run (int32_t, 0xabcdef15, 1);
70 run (int32_t, 0xabcdef15, 13);