1 /* { dg-options "-O2" } */
2 
3 __extension__ typedef __INTPTR_TYPE__ intptr_t;
4 typedef unsigned long long uint64_t;
5 extern void linker_error (void);
6 
cvmx_write64_uint64(uint64_t addr,uint64_t val)7 static inline void cvmx_write64_uint64(uint64_t addr, uint64_t val)
8 {
9   *(volatile uint64_t *)(intptr_t)addr = val;
10 };
cvmx_read64_uint64(uint64_t addr)11 static inline uint64_t cvmx_read64_uint64(uint64_t addr)
12 {
13   return *(volatile uint64_t *)(intptr_t)addr;
14 };
cvmx_write_csr(uint64_t csr_addr,uint64_t val)15 static inline void cvmx_write_csr(uint64_t csr_addr, uint64_t val)
16 {
17     cvmx_write64_uint64 (csr_addr, val);
18     if ((csr_addr >> 40) != 0x800118)
19       linker_error ();
20 }
21 
22 int interface;
23 int idx;
24 
25 int
main()26 main ()
27 {
28     cvmx_write_csr((((((uint64_t) 2LL) << 62)
29 		     | ((0x0001180008000208ull
30 			 + (((idx)&3)*2048)
31 			 + (((interface)&1)*0x8000000ull))))), 1);
32   return 0;
33 }
34