| 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 |
| 13 |
|
| 14 |
..... |
| 15 |
|
| 16 |
mov.l @r4,r2 |
| 17 |
tst r2,r2 |
| 18 |
bra .L3 |
| 19 |
movt r2 |
| 20 |
|
| 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" } } */ |
| 29 |
|
| 30 |
struct request |
| 31 |
{ |
| 32 |
unsigned long nr_sectors; |
| 33 |
}; |
| 34 |
|
| 35 |
struct request_list |
| 36 |
{ |
| 37 |
int count; |
| 38 |
}; |
| 39 |
|
| 40 |
struct request_queue |
| 41 |
{ |
| 42 |
struct request_list rq; |
| 43 |
volatile int nr_sectors; |
| 44 |
int max_queue_sectors; |
| 45 |
int can_throttle; |
| 46 |
unsigned long bounce_pfn; |
| 47 |
}; |
| 48 |
|
| 49 |
typedef struct request_queue request_queue_t; |
| 50 |
|
| 51 |
static inline int |
| 52 |
blk_oversized_queue (request_queue_t* q) |
| 53 |
{ |
| 54 |
if (q->can_throttle) |
| 55 |
return q->nr_sectors > q->max_queue_sectors; |
| 56 |
return q->rq.count == 0; |
| 57 |
} |
| 58 |
|
| 59 |
struct request* |
| 60 |
get_request (request_queue_t* q, int rw) |
| 61 |
{ |
| 62 |
struct request* rq = ((void*)0); |
| 63 |
struct request_list *rl = &q->rq; |
| 64 |
|
| 65 |
if (blk_oversized_queue (q)) |
| 66 |
{ |
| 67 |
if ((rw == 1) || (rw == 0)) |
| 68 |
return ((void*)0); |
| 69 |
if (blk_oversized_queue (q)) |
| 70 |
return ((void*)0); |
| 71 |
} |
| 72 |
|
| 73 |
return (void*)-100; |
| 74 |
} |