Debian Codegraph @

gcc/testsuite/gcc.target/loongarch/attr-model-test.c

raw
1 #ifdef ATTR_MODEL_TEST
2 int x __attribute__((model("extreme")));
3 int y __attribute__((model("normal")));
4 int z;
5
6 int
7 test(void)
8 {
9 return x + y + z;
10 }
11
12 /* The following will be used for kernel per-cpu storage implemention. */
13
14 register char *per_cpu_base __asm__("r21");
15 static int counter __attribute__((section(".data..percpu"), model("extreme")));
16
17 void
18 inc_counter(void)
19 {
20 int *ptr = (int *)(per_cpu_base + (long)&counter);
21 (*ptr)++;
22 }
23 #endif
24
25 int dummy;