Debian Codegraph @

gcc/testsuite/gcc.dg/rtl/test.c

raw
1 int test_1 (int i, int j, int k)
2 {
3 if (i < j)
4 return k + 4;
5 else
6 return -k;
7 }
8
9 /* Example showing:
10 - data structure
11 - loop
12 - call to "abort". */
13
14 struct foo
15 {
16 int count;
17 float *data;
18 };
19
20 float test_2 (struct foo *lhs, struct foo *rhs)
21 {
22 float result = 0.0f;
23
24 if (lhs->count != rhs->count)
25 __builtin_abort ();
26
27 for (int i = 0; i < lhs->count; i++)
28 result += lhs->data[i] * rhs->data[i];
29
30 return result;
31 }