2018-03-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / nios2 / const-addr-3.c
blob73b25e71cd0182d7ea3b1d7343b0e1f08039be7c
1 /* { dg-do compile } */
2 /* { dg-options "-march=r2 -mno-cdx -mno-bmx -O2" } */
3 /* { dg-final { scan-assembler-times "stwio\tr., 0\\(r" 2 } } */
4 /* { dg-final { scan-assembler-times "stwio\tr., 528\\(r0\\)" 1 } } */
6 /* These functions should not spill to stack. */
7 /* { dg-final { scan-assembler-not "addi\tsp, sp" } } */
9 /* On R2, stwio takes only a 12-bit displacement so foo1 and foo2 need
10 to use register indirect addressing. */
12 #define addr1 ((volatile int *) 0x43210)
13 #define addr2 ((volatile int *) 0x3210)
14 #define addr3 ((volatile int *) 0x210)
16 #define SET(l,r) __builtin_stwio ((l), (r))
18 void foo1 (int x) { SET (addr1, x); }
19 void foo2 (int x) { SET (addr2, x); }
20 void foo3 (int x) { SET (addr3, x); }