aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-19.c
blob: 5845d93f60a1a00d74360240285e4138ec8e45b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* Check that no unnecessary T bit stores are done before conditional
   branches.
   This case was extracted from the CSiBE set and contained the following
   sequence:
	mov.l	@(8,r4),r2
	mov.l	@(4,r4),r3
	cmp/gt	r2,r3
	movt	r2
.L3:
	tst	r2,r2
	bt/s	.L12
	mov	#-1,r0

	.....

	mov.l	@r4,r2
	tst	r2,r2
	bra	.L3
	movt	r2

   In this reduced code the movt insns were only present in the
   unwanted sequences.  Thus, if we see any movt insns, something is not
   working as expected.  This test requires -O2 because the T bit stores
   in question will be eliminated in additional insn split passes after
   reload.  */
/* { dg-do compile }  */
/* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" } { "" } } */
/* { dg-final { scan-assembler-not "movt" } } */

struct request
{
 unsigned long nr_sectors;
};

struct request_list
{
 int count;
};

struct request_queue
{
 struct request_list rq;
 volatile int nr_sectors;
 int max_queue_sectors;
 int can_throttle;
 unsigned long bounce_pfn;
};

typedef struct request_queue request_queue_t;

static inline int
blk_oversized_queue (request_queue_t* q)
{
  if (q->can_throttle)
    return q->nr_sectors > q->max_queue_sectors;
  return q->rq.count == 0;
}

struct request*
get_request (request_queue_t* q, int rw)
{
  struct request* rq = ((void*)0);
  struct request_list *rl = &q->rq;

  if (blk_oversized_queue (q))
    {
      if ((rw == 1) || (rw == 0))
	return ((void*)0);
      if (blk_oversized_queue (q))
	return ((void*)0);
    }

  return (void*)-100;
}