OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [pr18241-2.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-std=gnu99 -Wall -Wextra -O1" } */
3
 
4
extern void *memset (void*, int, __SIZE_TYPE__);
5
extern void abort (void);
6
 
7
struct radix_tree_root {
8
        unsigned int height;
9
        struct radix_tree_node *rnode;
10
};
11
 
12
struct radix_tree_node {
13
        unsigned int count;
14
        void *slots[64];
15
        unsigned long tags[2];
16
};
17
 
18
struct radix_tree_path {
19
        struct radix_tree_node *node, **slot;
20
        int offset;
21
};
22
 
23
void radix_tree_tag_clear(struct radix_tree_root *root, unsigned long index)
24
{
25
        struct radix_tree_path path[7], *pathp = path;
26
        unsigned int height, shift;
27
        volatile unsigned long *addr;
28
 
29
        height = root->height;
30
 
31
        shift = (height - 1) * 6;
32
        path[0].slot = &root->rnode;
33
 
34
        while (height > 0) {
35
                int offset;
36
 
37
                offset = (index >> shift) & (64-1);
38
                pathp[1].offset = offset;
39
                pathp[1].node = *pathp[0].slot;
40
                pathp[1].slot = (struct radix_tree_node **)
41
                        (pathp[1].node->slots + offset);
42
                pathp++;
43
                shift -= 6;
44
                height--;
45
        }
46
 
47
        addr = &(pathp->node->tags[0]) + 1;
48
        *addr = 574;
49
}
50
 
51
struct radix_tree_root r;
52
struct radix_tree_node node;
53
 
54
int main ()
55
{
56
        r.height = 1;
57
        r.rnode = &node;
58
 
59
        memset (&node, 0, sizeof (node));
60
 
61
        node.count = 1;
62
 
63
        radix_tree_tag_clear (&r, 13);
64
        return 0;
65
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.