2018-02-09 Sebastian Perta <sebastian.perta@renesas.com>
[official-gcc.git] / gcc / testsuite / gcc.target / sh / pr51244-19.c
blob328099dc26ef2de40e276f90b2d4749019b3cf0d
1 /* Check that no unnecessary T bit stores are done before conditional
2 branches.
3 This case was extracted from the CSiBE set and contained the following
4 sequence:
5 mov.l @(8,r4),r2
6 mov.l @(4,r4),r3
7 cmp/gt r2,r3
8 movt r2
9 .L3:
10 tst r2,r2
11 bt/s .L12
12 mov #-1,r0
14 .....
16 mov.l @r4,r2
17 tst r2,r2
18 bra .L3
19 movt r2
21 In this reduced code the movt insns were only present in the
22 unwanted sequences. Thus, if we see any movt insns, something is not
23 working as expected. This test requires -O2 because the T bit stores
24 in question will be eliminated in additional insn split passes after
25 reload. */
26 /* { dg-do compile } */
27 /* { dg-options "-O2" } */
28 /* { dg-final { scan-assembler-not "movt" } } */
30 struct request
32 unsigned long nr_sectors;
35 struct request_list
37 int count;
40 struct request_queue
42 struct request_list rq;
43 volatile int nr_sectors;
44 int max_queue_sectors;
45 int can_throttle;
46 unsigned long bounce_pfn;
49 typedef struct request_queue request_queue_t;
51 static inline int
52 blk_oversized_queue (request_queue_t* q)
54 if (q->can_throttle)
55 return q->nr_sectors > q->max_queue_sectors;
56 return q->rq.count == 0;
59 struct request*
60 get_request (request_queue_t* q, int rw)
62 struct request* rq = ((void*)0);
63 struct request_list *rl = &q->rq;
65 if (blk_oversized_queue (q))
67 if ((rw == 1) || (rw == 0))
68 return ((void*)0);
69 if (blk_oversized_queue (q))
70 return ((void*)0);
73 return (void*)-100;