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 
9 typedef unsigned int uint32_t;
10 typedef unsigned int uint16_t;
11 
12 struct 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 };
20 typedef struct dma_desc e_dma_desc_t;
21 
22 e_dma_desc_t dma;
23 int a;
24 int id[8];
25 #define NULL ((void *)0)
26 
_ez_dma_set(register e_dma_desc_t * dma,uint32_t config,e_dma_desc_t * next,uint16_t inner_src,uint16_t inner_dst,uint16_t inner_count,uint16_t outer_count,uint16_t outer_src,uint16_t outer_dst,void * src,void * dst)27 static 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 
44 void __attribute__((section(".text.ds1")))
dmas_inline1(void)45 dmas_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