Commit | Line | Data |
---|---|---|
4a71579b PC |
1 | #include "ldst.inc" |
2 | ||
3 | #if __WORDSIZE == 64 | |
4 | # define LDSTL(N, R0, R1) \ | |
5 | stxi_i $offui %R0 %R1 \ | |
6 | movi %R1 L##N \ | |
7 | stxi_l $offl %R0 %R1 | |
8 | ||
9 | # define SI(C, N, x, X, R0) \ | |
10 | ldxi_##x %R0 %R0 $off##x \ | |
11 | beqi L##x##C %R0 L##X##N \ | |
12 | calli @abort \ | |
13 | L##x##C: | |
14 | ||
15 | # define LDRL(C, N, R0, R1) \ | |
16 | UI(C, N, i, I, R0) \ | |
17 | movi %R0 t0 \ | |
18 | SI(C, N, l, L, R0) | |
19 | #else | |
20 | # define LDSTL(C, R0, R1) | |
21 | # define SI(C, N, x, X, R0) \ | |
22 | ldxi_##x %R0 %R0 $off##x \ | |
23 | beqi L##x##C %R0 I##X##N \ | |
24 | calli @abort \ | |
25 | L##x##C: | |
26 | ||
27 | # define LDRL(C, N, R0, R1) | |
28 | ||
29 | #endif | |
30 | ||
31 | #define UI(C, N, x, X, R0) \ | |
32 | ldxi_u##x %R0 %R0 $offu##x \ | |
33 | beqi Lu##x##C %R0 X##N \ | |
34 | calli @abort \ | |
35 | Lu##x##C: | |
36 | ||
37 | #define LDST1(X, N, R0, R1) \ | |
38 | movi %R0 t0 \ | |
39 | movi %R1 C##N \ | |
40 | stxi_c $offc %R0 %R1 \ | |
41 | stxi_c $offuc %R0 %R1 \ | |
42 | movi %R1 S##N \ | |
43 | stxi_s $offs %R0 %R1 \ | |
44 | stxi_s $offus %R0 %R1 \ | |
45 | movi %R1 I##N \ | |
46 | stxi_i $offi %R0 %R1 \ | |
47 | LDSTL(N, R0, R1) \ | |
48 | SI(X, N, c, C, R0) \ | |
49 | movi %R0 t0 \ | |
50 | UI(X, N, c, C, R0) \ | |
51 | movi %R0 t0 \ | |
52 | SI(X, N, s, S, R0) \ | |
53 | movi %R0 t0 \ | |
54 | UI(X, N, s, S, R0) \ | |
55 | movi %R0 t0 \ | |
56 | SI(X, N, i, I, R0) \ | |
57 | movi %R0 t0 \ | |
58 | LDRL(X, N, R0, R1) \ | |
59 | ||
60 | #define LDST0(R0, R1) \ | |
61 | LDST1(0_##R0##_##R1, 0, R0, R1) \ | |
62 | LDST1(1_##R0##_##R1, 1, R0, R1) \ | |
63 | LDST1(2_##R0##_##R1, 2, R0, R1) \ | |
64 | LDST1(3_##R0##_##R1, 3, R0, R1) | |
65 | ||
66 | #define LDST(V0, V1, V2, R0, R1, R2) \ | |
67 | LDST0(V0, V1) \ | |
68 | LDST0(V0, V2) \ | |
69 | LDST0(V0, R0) \ | |
70 | LDST0(V0, R1) \ | |
71 | LDST0(V0, R2) \ | |
72 | LDST0(V1, V2) \ | |
73 | LDST0(V1, R0) \ | |
74 | LDST0(V1, R1) \ | |
75 | LDST0(V1, R2) \ | |
76 | LDST0(V2, R0) \ | |
77 | LDST0(V2, R1) \ | |
78 | LDST0(V2, R2) \ | |
79 | LDST0(R0, V0) \ | |
80 | LDST0(R0, V1) \ | |
81 | LDST0(R0, V2) \ | |
82 | LDST0(R0, R1) \ | |
83 | LDST0(R0, R2) \ | |
84 | LDST0(R1, V0) \ | |
85 | LDST0(R1, V1) \ | |
86 | LDST0(R1, V2) \ | |
87 | LDST0(R1, R0) \ | |
88 | LDST0(R1, R2) \ | |
89 | LDST0(R2, V0) \ | |
90 | LDST0(R2, V1) \ | |
91 | LDST0(R2, V2) \ | |
92 | LDST0(R2, R0) \ | |
93 | LDST0(R2, R1) | |
94 | ||
95 | .code | |
96 | prolog | |
97 | ||
98 | /* Simple test to simplify validating encodings before | |
99 | * brute force tests */ | |
100 | movi %r0 t0 | |
101 | movi %r1 0x81 | |
102 | stxi_c $offc %r0 %r1 | |
103 | stxi_c $offuc %r0 %r1 | |
104 | movi %r1 0x8001 | |
105 | stxi_s $offs %r0 %r1 | |
106 | stxi_s $offus %r0 %r1 | |
107 | movi %r1 0x80000001 | |
108 | stxi_i $offi %r0 %r1 | |
109 | #if __WORDSIZE == 64 | |
110 | stxi_i $offui %r0 %r1 | |
111 | movi %r1 0x8000000000000001 | |
112 | stxi_l $offl %r0 %r1 | |
113 | #endif | |
114 | ldxi_c %r0 %r0 $offc | |
115 | beqi Lc %r0 XC | |
116 | calli @abort | |
117 | Lc: | |
118 | movi %r0 t0 | |
119 | ldxi_uc %r0 %r0 $offuc | |
120 | beqi Luc %r0 0x81 | |
121 | calli @abort | |
122 | Luc: | |
123 | movi %r0 t0 | |
124 | ldxi_s %r0 %r0 $offs | |
125 | beqi Ls %r0 XS | |
126 | calli @abort | |
127 | Ls: | |
128 | movi %r0 t0 | |
129 | ldxi_us %r0 %r0 $offus | |
130 | beqi Lus %r0 0x8001 | |
131 | calli @abort | |
132 | Lus: | |
133 | movi %r0 t0 | |
134 | ldxi_i %r0 %r0 $offi | |
135 | beqi Li %r0 XI | |
136 | calli @abort | |
137 | Li: | |
138 | #if __WORDSIZE == 64 | |
139 | movi %r0 t0 | |
140 | ldxi_ui %r0 %r0 $offui | |
141 | beqi Lui %r0 0x80000001 | |
142 | calli @abort | |
143 | Lui: | |
144 | movi %r0 t0 | |
145 | ldxi_l %r0 %r0 $offl | |
146 | beqi Ll %r0 0x8000000000000001 | |
147 | calli @abort | |
148 | Ll: | |
149 | #endif | |
150 | ||
151 | LDST(v0, v1, v2, r0, r1, r2) | |
152 | // just to know did not abort | |
153 | prepare | |
154 | pushargi ok | |
155 | ellipsis | |
156 | finishi @printf | |
157 | ret | |
158 | epilog |