Update ChangeLog and version files for release
[official-gcc.git] / gcc / testsuite / gcc.target / arm / lp1243022.c
blob5f26994a74c9a599961d4fdbf2f579e4a8c25a2e
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 /* { dg-final { cleanup-rtl-dump "subreg2" } } */
6 struct device;
7 typedef unsigned int __u32;
8 typedef unsigned long long u64;
9 typedef __u32 __le32;
10 typedef u64 dma_addr_t;
11 typedef unsigned gfp_t;
12 int dev_warn (const struct device *dev, const char *fmt, ...);
13 struct usb_bus
15 struct device *controller;
17 struct usb_hcd
19 struct usb_bus self;
21 struct xhci_generic_trb
23 __le32 field[4];
25 union xhci_trb
27 struct xhci_generic_trb generic;
29 struct xhci_segment
31 union xhci_trb *trbs;
32 dma_addr_t dma;
34 struct xhci_ring
36 struct xhci_segment *first_seg;
38 struct xhci_hcd
40 struct xhci_ring *cmd_ring;
41 struct xhci_ring *event_ring;
43 struct usb_hcd *xhci_to_hcd (struct xhci_hcd *xhci)
46 dma_addr_t xhci_trb_virt_to_dma (struct xhci_segment * seg,
47 union xhci_trb * trb);
48 struct xhci_segment *trb_in_td (struct xhci_segment *start_seg,
49 dma_addr_t suspect_dma);
50 int
51 xhci_test_trb_in_td (struct xhci_hcd *xhci, struct xhci_segment *input_seg,
52 union xhci_trb *start_trb, union xhci_trb *end_trb,
53 dma_addr_t input_dma, struct xhci_segment *result_seg,
54 char *test_name, int test_number)
56 unsigned long long start_dma;
57 unsigned long long end_dma;
58 struct xhci_segment *seg;
59 start_dma = xhci_trb_virt_to_dma (input_seg, start_trb);
60 end_dma = xhci_trb_virt_to_dma (input_seg, end_trb);
62 dev_warn (xhci_to_hcd (xhci)->self.controller,
63 "%d\n", test_number);
64 dev_warn (xhci_to_hcd (xhci)->self.controller,
65 "Expected seg %p, got seg %p\n", result_seg, seg);
68 int
69 xhci_check_trb_in_td_math (struct xhci_hcd *xhci, gfp_t mem_flags)
71 struct
73 dma_addr_t input_dma;
74 struct xhci_segment *result_seg;
76 simple_test_vector[] =
79 0, ((void *) 0)
83 xhci->event_ring->first_seg->dma - 16, ((void *) 0)}
86 xhci->event_ring->first_seg->dma - 1, ((void *) 0)}
89 xhci->event_ring->first_seg->dma, xhci->event_ring->first_seg}
92 xhci->event_ring->first_seg->dma + (64 - 1) * 16,
93 xhci->event_ring->first_seg
97 xhci->event_ring->first_seg->dma + (64 - 1) * 16 + 1, ((void *) 0)}
100 xhci->event_ring->first_seg->dma + (64) * 16, ((void *) 0)}
103 (dma_addr_t) (~0), ((void *) 0)
106 struct
108 struct xhci_segment *input_seg;
109 union xhci_trb *start_trb;
110 union xhci_trb *end_trb;
111 dma_addr_t input_dma;
112 struct xhci_segment *result_seg;
114 complex_test_vector[] =
117 .input_seg = xhci->event_ring->first_seg,.start_trb =
118 xhci->event_ring->first_seg->trbs,.end_trb =
119 &xhci->event_ring->first_seg->trbs[64 - 1],.input_dma =
120 xhci->cmd_ring->first_seg->dma,.result_seg = ((void *) 0),
124 .input_seg = xhci->event_ring->first_seg,.start_trb =
125 xhci->event_ring->first_seg->trbs,.end_trb =
126 &xhci->cmd_ring->first_seg->trbs[64 - 1],.input_dma =
127 xhci->cmd_ring->first_seg->dma,.result_seg = ((void *) 0),
131 .input_seg = xhci->event_ring->first_seg,.start_trb =
132 xhci->cmd_ring->first_seg->trbs,.end_trb =
133 &xhci->cmd_ring->first_seg->trbs[64 - 1],.input_dma =
134 xhci->cmd_ring->first_seg->dma,.result_seg = ((void *) 0),
138 .input_seg = xhci->event_ring->first_seg,.start_trb =
139 &xhci->event_ring->first_seg->trbs[0],.end_trb =
140 &xhci->event_ring->first_seg->trbs[3],.input_dma =
141 xhci->event_ring->first_seg->dma + 4 * 16,.result_seg = ((void *) 0),
145 .input_seg = xhci->event_ring->first_seg,.start_trb =
146 &xhci->event_ring->first_seg->trbs[3],.end_trb =
147 &xhci->event_ring->first_seg->trbs[6],.input_dma =
148 xhci->event_ring->first_seg->dma + 2 * 16,.result_seg = ((void *) 0),
152 .input_seg = xhci->event_ring->first_seg,.start_trb =
153 &xhci->event_ring->first_seg->trbs[64 - 3],.end_trb =
154 &xhci->event_ring->first_seg->trbs[1],.input_dma =
155 xhci->event_ring->first_seg->dma + 2 * 16,.result_seg = ((void *) 0),
159 .input_seg = xhci->event_ring->first_seg,.start_trb =
160 &xhci->event_ring->first_seg->trbs[64 - 3],.end_trb =
161 &xhci->event_ring->first_seg->trbs[1],.input_dma =
162 xhci->event_ring->first_seg->dma + (64 - 4) * 16,.result_seg =
163 ((void *) 0),
167 .input_seg = xhci->event_ring->first_seg,.start_trb =
168 &xhci->event_ring->first_seg->trbs[64 - 3],.end_trb =
169 &xhci->event_ring->first_seg->trbs[1],.input_dma =
170 xhci->cmd_ring->first_seg->dma + 2 * 16,.result_seg = ((void *) 0),
173 unsigned int num_tests;
174 int i, ret;
175 num_tests =
176 (sizeof (simple_test_vector) / sizeof ((simple_test_vector)[0]) +
177 (sizeof (struct
180 )));
181 for (i = 0; i < num_tests; i++)
183 ret =
184 xhci_test_trb_in_td (xhci, xhci->event_ring->first_seg,
185 xhci->event_ring->first_seg->trbs,
186 &xhci->event_ring->first_seg->trbs[64 - 1],
187 simple_test_vector[i].input_dma,
188 simple_test_vector[i].result_seg, "Simple", i);
189 if (ret < 0)
190 return ret;
192 for (i = 0; i < num_tests; i++)
194 ret =
195 xhci_test_trb_in_td (xhci, complex_test_vector[i].input_seg,
196 complex_test_vector[i].start_trb,
197 complex_test_vector[i].end_trb,
198 complex_test_vector[i].input_dma,
199 complex_test_vector[i].result_seg, "Complex", i);
200 if (ret < 0)
201 return ret;