gcc/testsuite/
[official-gcc.git] / gcc / testsuite / gcc.target / sh / pr51244-14.c
blob61a5dc93b286f97949712dc1a0ef456b4527ba4f
1 /* This is a case extracted from CSiBE which would sometimes contain the
2 following sequence:
3 cmp/eq r12,r13
4 movt r0
5 xor #1,r0
6 extu.b r0,r0
7 movt r3
8 tst r0,r0
9 bf/s .L35
10 where the negated T bit store did not combine properly. Since there are
11 other movt insns and the sequence will try to utilize the 'movt_movrt'
12 patterns, we only check for the extu. */
13 /* { dg-do compile } */
14 /* { dg-options "-O2" } */
15 /* { dg-skip-if "" { "sh*-*-*" } { "-m5*" } { "" } } */
16 /* { dg-final { scan-assembler-not "extu" } } */
18 typedef struct transaction_s transaction_t;
20 struct journal_head
22 transaction_t * b_transaction;
23 struct journal_head *b_cpnext, *b_cpprev;
26 struct transaction_s
28 struct journal_head * t_checkpoint_list;
29 transaction_t *t_cpnext, *t_cpprev;
32 struct journal_s
34 transaction_t * j_checkpoint_transactions;
35 unsigned long j_first, j_last;
38 typedef struct journal_s journal_t;
40 extern int __try_to_free_cp_buf (struct journal_head *jh);
41 extern int __cleanup_transaction (journal_t *journal, transaction_t *transaction);
42 extern void __flush_batch (void **bhs, int *batch_count);
43 extern void* jh2bh (void*);
45 static int
46 __flush_buffer (journal_t *journal, struct journal_head *jh,
47 void **bhs, int *batch_count, int *drop_count)
49 void *bh = jh2bh (jh);
50 int ret = 0;
51 if (bh)
53 bhs[*batch_count] = bh;
54 (*batch_count)++;
55 if (*batch_count == 64)
56 ret = 1;
58 else
60 int last_buffer = 0;
61 if (jh->b_cpnext == jh)
62 last_buffer = 1;
63 if (__try_to_free_cp_buf (jh))
65 (*drop_count)++;
66 ret = last_buffer;
69 return ret;
72 int
73 log_do_checkpoint (journal_t *journal, int nblocks)
75 transaction_t *transaction, *last_transaction, *next_transaction;
76 int batch_count = 0;
77 void *bhs[64];
79 repeat:
80 transaction = journal->j_checkpoint_transactions;
81 if (transaction == ((void *)0))
82 return 0;
83 last_transaction = transaction->t_cpprev;
84 next_transaction = transaction;
87 struct journal_head *jh, *last_jh, *next_jh;
88 int drop_count = 0;
89 int cleanup_ret, retry = 0;
90 transaction = next_transaction;
91 next_transaction = transaction->t_cpnext;
92 jh = transaction->t_checkpoint_list;
93 last_jh = jh->b_cpprev;
94 next_jh = jh;
97 jh = next_jh;
98 next_jh = jh->b_cpnext;
99 retry = __flush_buffer(journal, jh, bhs, &batch_count, &drop_count);
100 } while (jh != last_jh && !retry);
102 if (retry)
103 goto repeat;
105 cleanup_ret = __cleanup_transaction(journal, transaction);
106 goto repeat;
107 } while (transaction != last_transaction);