Debian Codegraph @

gcc/testsuite/gcc.target/bpf/memmove-1.c

raw
1 /* Ensure memmove is expanded inline rather than emitting a libcall. */
2
3 /* { dg-do compile } */
4 /* { dg-options "-O2" } */
5
6 struct context {
7 unsigned int data;
8 unsigned int data_end;
9 unsigned int data_meta;
10 unsigned int ingress;
11 unsigned int queue_index;
12 unsigned int egress;
13 };
14
15 void
16 mov_1_nooverlap (struct context *ctx)
17 {
18 void *data = (void *)(long)ctx->data;
19 char *dest;
20 dest = data;
21 dest += 16;
22
23 __builtin_memmove (dest, data, 12);
24 }
25
26 void
27 mov_1_overlap (struct context *ctx)
28 {
29 void *data = (void *)(long)ctx->data;
30 char *dest;
31 dest = data;
32 dest += 4;
33
34 __builtin_memmove (dest, data, 12);
35 }
36
37 void
38 mov_1_arbitrary (struct context *ctx_a, struct context *ctx_b)
39 {
40 void *src = (void *)(long)ctx_a->data;
41 void *dst = (void *)(long)ctx_b->data;
42
43 __builtin_memmove (dst, src, 12);
44 }
45
46 /* { dg-final { scan-assembler-times "call" 0 } } */