1 /* { dg-do assemble } */
2 /* { dg-options "-O3 -fomit-frame-pointer -funroll-loops -march=r2 -mcdx -w" } */
4 /* Based on gcc.c-torture/execute/20021120-1.c.
5 This test used to result in assembler errors with R2 CDX because of
6 a bug in regrename; it wasn't re-validating insns after renaming, so
7 ldwm/stwm instructions with incorrect registers were being emitted. */
9 /* Macros to emit "L Nxx R" for each octal number xx between 000 and 037. */
10 #define OP1(L, N, R, I, J) L N##I##J R
11 #define OP2(L, N, R, I) \
12 OP1(L, N, R, 0, I), OP1(L, N, R, 1, I), \
13 OP1(L, N, R, 2, I), OP1(L, N, R, 3, I)
15 OP2(L, N, R, 0), OP2(L, N, R, 1), OP2(L, N, R, 2), OP2(L, N, R, 3), \
16 OP2(L, N, R, 4), OP2(L, N, R, 5), OP2(L, N, R, 6), OP2(L, N, R, 7)
18 /* Declare 32 unique variables with prefix N. */
19 #define DECLARE(N) OP (, N,)
21 /* Copy 32 variables with prefix N from the array at ADDR.
22 Leave ADDR pointing to the end of the array. */
23 #define COPYIN(N, ADDR) OP (, N, = *(ADDR++))
25 /* Likewise, but copy the other way. */
26 #define COPYOUT(N, ADDR) OP (*(ADDR++) =, N,)
28 /* Add the contents of the array at ADDR to 32 variables with prefix N.
29 Leave ADDR pointing to the end of the array. */
30 #define ADD(N, ADDR) OP (, N, += *(ADDR++))
32 volatile double gd
[32];
33 volatile float gf
[32];
43 pd
= gd
; COPYIN (d
, pd
);
44 for (i
= 0; i
< n
; i
++)
46 pf
= gf
; COPYIN (f
, pf
);
50 pf
= gf
; COPYOUT (f
, pf
);
52 pd
= gd
; COPYOUT (d
, pd
);
59 for (i
= 0; i
< 32; i
++)
62 for (i
= 0; i
< 32; i
++)
63 if (gd
[i
] != i
* 4 || gf
[i
] != i
)