2 /* { dg-options "-std=gnu99 -Wall -Wextra -O1" } */
4 extern void *memset (void*, int, __SIZE_TYPE__
);
5 extern void abort (void);
7 struct radix_tree_root
{
9 struct radix_tree_node
*rnode
;
12 struct radix_tree_node
{
15 unsigned long tags
[2][2];
18 struct radix_tree_path
{
19 struct radix_tree_node
*node
, **slot
;
23 static unsigned long height_to_maxindex
[7] =
24 {0, 63, 4095, 262143, 16777215, 1073741823, 4294967295};
26 static inline void tag_clear(struct radix_tree_node
*node
, int tag
, int offset
)
29 volatile unsigned long *addr
;
30 #if(__SIZEOF_INT__ >= 4)
37 addr
= &node
->tags
[tag
][0];
40 mask
= 1 << (nr
& 0x1f);
44 void *radix_tree_tag_clear(struct radix_tree_root
*root
, unsigned long index
, int tag
)
46 struct radix_tree_path path
[7], *pathp
= path
;
47 unsigned int height
, shift
;
50 height
= root
->height
;
51 if (index
> height_to_maxindex
[height
])
54 shift
= (height
- 1) * 6;
56 pathp
->slot
= &root
->rnode
;
61 if (*pathp
->slot
== 0)
64 offset
= (index
>> shift
) & (64-1);
65 pathp
[1].offset
= offset
;
66 pathp
[1].node
= *pathp
[0].slot
;
67 pathp
[1].slot
= (struct radix_tree_node
**)
68 (pathp
[1].node
->slots
+ offset
);
81 tag_clear(pathp
[0].node
, tag
, pathp
[0].offset
);
82 for (idx
= 0; idx
< 2; idx
++) {
83 if (pathp
[0].node
->tags
[tag
][idx
])
87 } while (pathp
[0].node
);
94 struct radix_tree_root r
;
95 struct radix_tree_node node
;
96 void *p
= (void *) 0xdeadbeef;
101 memset (&node
, 0, sizeof (node
));
106 radix_tree_tag_clear (&r
, 13, 1);
108 if (r
.rnode
->slots
[13] != p
)