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 */
13 typedef __SIZE_TYPE__
size_t;
14 extern void* malloc (size_t);
15 extern void* memset (void*, int, size_t);
25 #define test(T, pattern) \
26 __attribute__((noinline)) \
29 while (*p_##T != pattern) \
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) \
48 assert (r == p_##T); \
49 assert (r == &q[i]); \
55 void *p
= malloc (1024);
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);