Debian Codegraph @

gcc/testsuite/gcc.target/bpf/core-builtin-fieldinfo-existence-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O0 -dA -gbtf -mco-re -masm=normal" } */
3
4 enum {
5 FIELD_EXISTENCE = 2,
6 };
7
8 typedef unsigned uint;
9
10 struct S {
11 unsigned char c;
12 int d;
13 uint u;
14 short ar[3];
15 };
16
17 unsigned int foo (struct S *s)
18 {
19 unsigned c = __builtin_preserve_field_info (s->c, FIELD_EXISTENCE);
20 unsigned d = __builtin_preserve_field_info (s->d, FIELD_EXISTENCE);
21 unsigned u = __builtin_preserve_field_info (s->u, FIELD_EXISTENCE);
22 unsigned ar = __builtin_preserve_field_info (s->ar[1], FIELD_EXISTENCE);
23
24 return c + d + u + ar;
25 }
26
27 /* { dg-final { scan-assembler-times "\[\t \]lddw\[\t \]%r\[0-9\],1" 4 } } */
28
29 /* { dg-final { scan-assembler-times "ascii \"0:0.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
30 /* { dg-final { scan-assembler-times "ascii \"0:1.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
31 /* { dg-final { scan-assembler-times "ascii \"0:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
32 /* { dg-final { scan-assembler-times "ascii \"0:3:1.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
33
34 /* { dg-final { scan-assembler-times "0x2\[\t \]+\[^\n\]*bpfcr_kind" 4 } } */