| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2" } */ |
| 3 |
|
| 4 |
extern void abort (void); |
| 5 |
extern void exit (int); |
| 6 |
|
| 7 |
static inline __attribute__((always_inline)) |
| 8 |
void |
| 9 |
prefetch (void *x) |
| 10 |
{ |
| 11 |
asm volatile("prefetcht0 %0" : : "m" (*(unsigned long *)x)); |
| 12 |
} |
| 13 |
|
| 14 |
struct hlist_head |
| 15 |
{ |
| 16 |
struct hlist_node *first; |
| 17 |
}; |
| 18 |
|
| 19 |
struct hlist_node |
| 20 |
{ |
| 21 |
struct hlist_node *next; |
| 22 |
unsigned long i_ino; |
| 23 |
}; |
| 24 |
|
| 25 |
struct hlist_node * find_inode_fast(struct hlist_head *head, unsigned long ino) |
| 26 |
{ |
| 27 |
struct hlist_node *node; |
| 28 |
|
| 29 |
for (node = head->first; |
| 30 |
node && (prefetch (node->next), 1); |
| 31 |
node = node->next) |
| 32 |
{ |
| 33 |
if (node->i_ino == ino) |
| 34 |
break; |
| 35 |
} |
| 36 |
return node ? node : 0; |
| 37 |
} |
| 38 |
|
| 39 |
struct hlist_node g2; |
| 40 |
struct hlist_node g1 = { &g2 }; |
| 41 |
struct hlist_head h = { &g1 }; |
| 42 |
|
| 43 |
int |
| 44 |
main() |
| 45 |
{ |
| 46 |
if (find_inode_fast (&h, 1) != 0) |
| 47 |
abort (); |
| 48 |
exit (0); |
| 49 |
} |