Debian Codegraph @

gcc/testsuite/gcc.target/riscv/memset-nonoverlapping.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-mcpu=sifive-u74 -march=rv64gc -mabi=lp64" } */
3 /* { dg-skip-if "" { *-*-* } { "-O0" "-Os" "-Oz" "-Og" } } */
4
5 #define ZERO_N(N) \
6 void zero##N (char *dst) \
7 { \
8 dst = __builtin_assume_aligned (dst, 4096); \
9 __builtin_memset (dst, 0, N); \
10 }
11
12 /* Emits 1x sd and 1x {sh,sb}. */
13 ZERO_N(11)
14
15 /* Emits 1x sd and 1x {sw,sb}. */
16 ZERO_N(13)
17
18 /* Emits 1x sd and 1x {sw,sh}. */
19 ZERO_N(14)
20
21 /* Emits 1x sd and 1x {sw,sh,sb}. */
22 ZERO_N(15)
23
24 /* Emits 2x sd and 1x {sh,sb}. */
25 ZERO_N(19)
26
27 /* Emits 2x sd and 1x {sw,sh,sb}. */
28 ZERO_N(23)
29
30 /* The by-pieces infrastructure handles up to 24 bytes.
31 So the code below is emitted via cpymemsi/block_move_straight. */
32
33 /* Emits 3x sd and 1x {sh,sb}. */
34 ZERO_N(27)
35
36 /* Emits 3x sd and 1x {sw,sb}. */
37 ZERO_N(29)
38
39 /* Emits 3x sd and 1x {sw,sh,sb}. */
40 ZERO_N(31)
41
42 /* { dg-final { scan-assembler-times "sd\t" 17 } } */
43 /* { dg-final { scan-assembler-times "sw\t" 6 } } */
44 /* { dg-final { scan-assembler-times "sh\t" 7 } } */
45 /* { dg-final { scan-assembler-times "sb\t" 8 } } */