PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / arm / lp1243022.c
blob11025eebd7125573b5b1a206726473b253a023f9
1 /* { dg-do compile { target arm_thumb2 } } */
2 /* { dg-options "-O2 -fdump-rtl-subreg2" } */
4 /* { dg-final { scan-rtl-dump "REG_INC" "subreg2" { target { ! arm_neon } } } } */
5 struct device;
6 typedef unsigned int __u32;
7 typedef unsigned long long u64;
8 typedef __u32 __le32;
9 typedef u64 dma_addr_t;
10 typedef unsigned gfp_t;
11 int dev_warn (const struct device *dev, const char *fmt, ...);
12 struct usb_bus
14 struct device *controller;
16 struct usb_hcd
18 struct usb_bus self;
20 struct xhci_generic_trb
22 __le32 field[4];
24 union xhci_trb
26 struct xhci_generic_trb generic;
28 struct xhci_segment
30 union xhci_trb *trbs;
31 dma_addr_t dma;
33 struct xhci_ring
35 struct xhci_segment *first_seg;
37 struct xhci_hcd
39 struct xhci_ring *cmd_ring;
40 struct xhci_ring *event_ring;
42 struct usb_hcd *xhci_to_hcd (struct xhci_hcd *xhci)
45 dma_addr_t xhci_trb_virt_to_dma (struct xhci_segment * seg,
46 union xhci_trb * trb);
47 struct xhci_segment *trb_in_td (struct xhci_segment *start_seg,
48 dma_addr_t suspect_dma);
49 int
50 xhci_test_trb_in_td (struct xhci_hcd *xhci, struct xhci_segment *input_seg,
51 union xhci_trb *start_trb, union xhci_trb *end_trb,
52 dma_addr_t input_dma, struct xhci_segment *result_seg,
53 char *test_name, int test_number)
55 unsigned long long start_dma;
56 unsigned long long end_dma;
57 struct xhci_segment *seg;
58 start_dma = xhci_trb_virt_to_dma (input_seg, start_trb);
59 end_dma = xhci_trb_virt_to_dma (input_seg, end_trb);
61 dev_warn (xhci_to_hcd (xhci)->self.controller,
62 "%d\n", test_number);
63 dev_warn (xhci_to_hcd (xhci)->self.controller,
64 "Expected seg %p, got seg %p\n", result_seg, seg);
67 int
68 xhci_check_trb_in_td_math (struct xhci_hcd *xhci, gfp_t mem_flags)
70 struct
72 dma_addr_t input_dma;
73 struct xhci_segment *result_seg;
75 simple_test_vector[] =
78 0, ((void *) 0)
82 xhci->event_ring->first_seg->dma - 16, ((void *) 0)}
85 xhci->event_ring->first_seg->dma - 1, ((void *) 0)}
88 xhci->event_ring->first_seg->dma, xhci->event_ring->first_seg}
91 xhci->event_ring->first_seg->dma + (64 - 1) * 16,
92 xhci->event_ring->first_seg
96 xhci->event_ring->first_seg->dma + (64 - 1) * 16 + 1, ((void *) 0)}
99 xhci->event_ring->first_seg->dma + (64) * 16, ((void *) 0)}
102 (dma_addr_t) (~0), ((void *) 0)
105 struct
107 struct xhci_segment *input_seg;
108 union xhci_trb *start_trb;
109 union xhci_trb *end_trb;
110 dma_addr_t input_dma;
111 struct xhci_segment *result_seg;
113 complex_test_vector[] =
116 .input_seg = xhci->event_ring->first_seg,.start_trb =
117 xhci->event_ring->first_seg->trbs,.end_trb =
118 &xhci->event_ring->first_seg->trbs[64 - 1],.input_dma =
119 xhci->cmd_ring->first_seg->dma,.result_seg = ((void *) 0),
123 .input_seg = xhci->event_ring->first_seg,.start_trb =
124 xhci->event_ring->first_seg->trbs,.end_trb =
125 &xhci->cmd_ring->first_seg->trbs[64 - 1],.input_dma =
126 xhci->cmd_ring->first_seg->dma,.result_seg = ((void *) 0),
130 .input_seg = xhci->event_ring->first_seg,.start_trb =
131 xhci->cmd_ring->first_seg->trbs,.end_trb =
132 &xhci->cmd_ring->first_seg->trbs[64 - 1],.input_dma =
133 xhci->cmd_ring->first_seg->dma,.result_seg = ((void *) 0),
137 .input_seg = xhci->event_ring->first_seg,.start_trb =
138 &xhci->event_ring->first_seg->trbs[0],.end_trb =
139 &xhci->event_ring->first_seg->trbs[3],.input_dma =
140 xhci->event_ring->first_seg->dma + 4 * 16,.result_seg = ((void *) 0),
144 .input_seg = xhci->event_ring->first_seg,.start_trb =
145 &xhci->event_ring->first_seg->trbs[3],.end_trb =
146 &xhci->event_ring->first_seg->trbs[6],.input_dma =
147 xhci->event_ring->first_seg->dma + 2 * 16,.result_seg = ((void *) 0),
151 .input_seg = xhci->event_ring->first_seg,.start_trb =
152 &xhci->event_ring->first_seg->trbs[64 - 3],.end_trb =
153 &xhci->event_ring->first_seg->trbs[1],.input_dma =
154 xhci->event_ring->first_seg->dma + 2 * 16,.result_seg = ((void *) 0),
158 .input_seg = xhci->event_ring->first_seg,.start_trb =
159 &xhci->event_ring->first_seg->trbs[64 - 3],.end_trb =
160 &xhci->event_ring->first_seg->trbs[1],.input_dma =
161 xhci->event_ring->first_seg->dma + (64 - 4) * 16,.result_seg =
162 ((void *) 0),
166 .input_seg = xhci->event_ring->first_seg,.start_trb =
167 &xhci->event_ring->first_seg->trbs[64 - 3],.end_trb =
168 &xhci->event_ring->first_seg->trbs[1],.input_dma =
169 xhci->cmd_ring->first_seg->dma + 2 * 16,.result_seg = ((void *) 0),
172 unsigned int num_tests;
173 int i, ret;
174 num_tests =
175 (sizeof (simple_test_vector) / sizeof ((simple_test_vector)[0]) +
176 (sizeof (struct
179 )));
180 for (i = 0; i < num_tests; i++)
182 ret =
183 xhci_test_trb_in_td (xhci, xhci->event_ring->first_seg,
184 xhci->event_ring->first_seg->trbs,
185 &xhci->event_ring->first_seg->trbs[64 - 1],
186 simple_test_vector[i].input_dma,
187 simple_test_vector[i].result_seg, "Simple", i);
188 if (ret < 0)
189 return ret;
191 for (i = 0; i < num_tests; i++)
193 ret =
194 xhci_test_trb_in_td (xhci, complex_test_vector[i].input_seg,
195 complex_test_vector[i].start_trb,
196 complex_test_vector[i].end_trb,
197 complex_test_vector[i].input_dma,
198 complex_test_vector[i].result_seg, "Complex", i);
199 if (ret < 0)
200 return ret;