1/* { dg-do compile } */
2/* { dg-options "-O2 -fno-common" } */
3/* ??? we should be able to get down to 4 movt, but first we'll have to
4   teach mov2add about flag handling.  Maybe add the code that was removed in
5   r144425 from regmove to postreload; epiphany needs tweaks to the addsi3
6   expander to generate a CC reg clobber in the pass.  */
7/* { dg-final { scan-assembler-times "movt" 6 } } */
8
9typedef unsigned int uint32_t;
10typedef unsigned int uint16_t;
11
12struct dma_desc {
13   uint32_t config;
14   uint32_t inner_stride;
15   uint32_t count;
16   uint32_t outer_stride;
17   void *src_addr;
18   void *dst_addr;
19};
20typedef struct dma_desc e_dma_desc_t;
21
22e_dma_desc_t dma;
23int a;
24int id[8];
25#define NULL ((void *)0)
26
27static inline void _ez_dma_set(register e_dma_desc_t  *dma,
28                uint32_t config,
29                e_dma_desc_t *next,
30                uint16_t inner_src, uint16_t inner_dst,
31                uint16_t inner_count, uint16_t outer_count,
32                uint16_t outer_src, uint16_t outer_dst,
33                void *src, void*dst) {
34   //register e_dma_desc_t *dmap = dma;
35
36   dma->config = config | (((uint32_t)next)<<16);
37   dma->inner_stride = (inner_dst << 16) | inner_src;
38   dma->count = (inner_count << 16) | outer_count;
39   dma->outer_stride = (outer_dst << 16) | outer_src;
40   dma->src_addr = src;
41   dma->dst_addr = dst;
42}
43
44void __attribute__((section(".text.ds1")))
45dmas_inline1(void) {
46   register e_dma_desc_t *dmap = &dma;
47
48   _ez_dma_set(dmap, 3, NULL,
49          1, 2,
50          12, 13,
51          5, 1,
52          id, &a);
53}
54