Remove not needed __builtin_expect due to malloc predictor.
[official-gcc.git] / gcc / testsuite / gcc.target / sh / pr51244-13.c
blob04937e611581a85b358658c6f56edb58eb6075b0
1 /* This is a case extracted from CSiBE which contained the following
2 sequence:
3 shll r0
4 movt r0
5 tst r0,r0
6 bf .L11
7 where the 'tst r0,r0' before the branch can be omitted by inverting the
8 branch condition. The tested function contains two other tst insns. If
9 everything goes as expected we will be seeing only those other two tst
10 insns. */
11 /* { dg-do compile } */
12 /* { dg-options "-O2" } */
13 /* { dg-final { scan-assembler-times "tst" 2 } } */
15 void printk (const char*, const char*, int);
16 void __constant_set_bit (int, unsigned long int*);
17 void __set_bit (int, unsigned long int*);
19 static __inline__ int
20 __test_bit (unsigned long nr, volatile void * addr)
22 /* This is on purpose. */
23 int oldbit;
24 return oldbit & 1;
27 static __inline__ int
28 __constant_test_bit (unsigned long nr, volatile void * addr)
30 return (((volatile char *) addr)[(nr>>3)^7] & (1<<(nr&7))) != 0;
33 struct list_head
35 struct list_head *next, *prev;
38 void list_add (struct list_head*, struct list_head*);
40 static inline void
41 __list_del (struct list_head *prev, struct list_head *next)
43 next->prev = prev;
44 prev->next = next;
47 static inline void
48 list_del (struct list_head *entry)
50 __list_del(entry->prev, entry->next);
51 entry->next = 0;
52 entry->prev = 0;
55 extern int nr_active_pages;
56 extern int nr_inactive_pages;
57 extern struct list_head active_list;
59 typedef struct page
61 unsigned long flags;
62 struct list_head lru;
63 } mem_map_t;
65 void
66 activate_page_nolock (struct page * page)
68 if ((__builtin_constant_p((6))
69 ? __constant_test_bit((6),(&(page)->flags))
70 : __test_bit((6),(&(page)->flags)) )
71 && !(__builtin_constant_p((7))
72 ? __constant_test_bit((7),(&(page)->flags))
73 : __test_bit((7),(&(page)->flags)) ))
75 list_del(&(page)->lru);
76 nr_inactive_pages--;
77 if (!(__builtin_constant_p(6) ? __constant_test_bit((6),(&(page)->flags))
78 : __test_bit((6),(&(page)->flags))))
79 printk("", "", 43);
81 if ((__builtin_constant_p(7) ? __constant_test_bit((7),(&(page)->flags))
82 : __test_bit((7),(&(page)->flags))))
83 printk("", "", 43);
85 (__builtin_constant_p(7) ? __constant_set_bit((7),(&(page)->flags))
86 : __set_bit((7),(&(page)->flags)) );
87 list_add(&(page)->lru, &active_list);
88 nr_active_pages++;