Commit | Line | Data |
---|---|---|
4a71579b PC |
1 | #include "ldst.inc" |
2 | ||
3 | #if __WORDSIZE == 64 | |
4 | # define LDSTL(N, R0, R1) \ | |
5 | movi %R0 $(t0 + $offui) \ | |
6 | str_i %R0 %R1 \ | |
7 | movi %R0 $(t0 + $offl) \ | |
8 | movi %R1 L##N \ | |
9 | str_l %R0 %R1 | |
10 | ||
11 | # define SI(C, N, x, X, R0, R1) \ | |
12 | movi %R0 $(t0 + $off##x) \ | |
13 | ldr_##x %R1 %R0 \ | |
14 | beqi L##x##C %R1 L##X##N \ | |
15 | calli @abort \ | |
16 | L##x##C: | |
17 | ||
18 | # define LDRL(C, N, R0, R1) \ | |
19 | UI(C, N, i, I, R0, R1) \ | |
20 | SI(C, N, l, L, R0, R1) | |
21 | #else | |
22 | # define LDSTL(C, R0, R1) | |
23 | # define SI(C, N, x, X, R0, R1) \ | |
24 | movi %R0 $(t0 + $off##x) \ | |
25 | ldr_##x %R1 %R0 \ | |
26 | beqi L##x##C %R1 I##X##N \ | |
27 | calli @abort \ | |
28 | L##x##C: | |
29 | ||
30 | # define LDRL(C, N, R0, R1) | |
31 | ||
32 | #endif | |
33 | ||
34 | #define UI(C, N, x, X, R0, R1) \ | |
35 | movi %R0 $(t0 + $offu##x) \ | |
36 | ldr_u##x %R1 %R0 \ | |
37 | beqi Lu##x##C %R1 X##N \ | |
38 | calli @abort \ | |
39 | Lu##x##C: | |
40 | ||
41 | #define FF(C, N, x, X, R0, F0) \ | |
42 | movi %R0 $(t0 + $off##x) \ | |
43 | ldr_##x %F0 %R0 \ | |
44 | beqi_##x L##x##C %F0 X##N \ | |
45 | L##x##C: | |
46 | ||
47 | #define LDST1(X, N, R0, R1, F0) \ | |
48 | movi %R0 $(t0 + $offc) \ | |
49 | movi %R1 C##N \ | |
50 | str_c %R0 %R1 \ | |
51 | movi %R0 $(t0 + $offuc) \ | |
52 | str_c %R0 %R1 \ | |
53 | movi %R0 $(t0 + $offs) \ | |
54 | movi %R1 S##N \ | |
55 | str_s %R0 %R1 \ | |
56 | movi %R0 $(t0 + $offus) \ | |
57 | str_s %R0 %R1 \ | |
58 | movi %R0 $(t0 + $offi) \ | |
59 | movi %R1 I##N \ | |
60 | str_i %R0 %R1 \ | |
61 | LDSTL(N, R0, R1) \ | |
62 | movi %R0 $(t0 + $offf) \ | |
63 | movi_f %F0 F##N \ | |
64 | str_f %R0 %F0 \ | |
65 | movi %R0 $(t0 + $offd) \ | |
66 | movi_d %F0 D##N \ | |
67 | str_d %R0 %F0 \ | |
68 | SI(X, N, c, C, R0, R1) \ | |
69 | UI(X, N, c, C, R0, R1) \ | |
70 | SI(X, N, s, S, R0, R1) \ | |
71 | UI(X, N, s, S, R0, R1) \ | |
72 | SI(X, N, i, I, R0, R1) \ | |
73 | LDRL(X, N, R0, R1) \ | |
74 | FF(X, N, f, F, R0, F0) \ | |
75 | FF(X, N, d, D, R0, F0) | |
76 | ||
77 | #define LDST0(R0, R1, F0) \ | |
78 | LDST1(0_##R0##_##R1##_##F0, 0, R0, R1, F0) \ | |
79 | LDST1(1_##R0##_##R1##_##F0, 1, R0, R1, F0) \ | |
80 | LDST1(2_##R0##_##R1##_##F0, 2, R0, R1, F0) \ | |
81 | LDST1(3_##R0##_##R1##_##F0, 3, R0, R1, F0) | |
82 | ||
83 | #define LDST(V0, V1, V2, R0, R1, R2, F0, F1, F2, F3, F4, F5) \ | |
84 | LDST0(V0, V1, F0) \ | |
85 | LDST0(V0, V2, F1) \ | |
86 | LDST0(V0, R0, F3) \ | |
87 | LDST0(V0, R1, F4) \ | |
88 | LDST0(V0, R2, F5) \ | |
89 | LDST0(V1, V2, F0) \ | |
90 | LDST0(V1, R0, F1) \ | |
91 | LDST0(V1, R1, F2) \ | |
92 | LDST0(V1, R2, F3) \ | |
93 | LDST0(V2, R0, F4) \ | |
94 | LDST0(V2, R1, F5) \ | |
95 | LDST0(V2, R2, F0) | |
96 | ||
97 | .code | |
98 | prolog | |
99 | ||
100 | /* Simple test to simplify validating encodings before | |
101 | * brute force tests */ | |
102 | movi %r0 $(t0 + $offc) | |
103 | movi %r1 0x81 | |
104 | str_c %r0 %r1 | |
105 | movi %r0 $(t0 + $offuc) | |
106 | str_c %r0 %r1 | |
107 | movi %r0 $(t0 + $offs) | |
108 | movi %r1 0x8001 | |
109 | str_s %r0 %r1 | |
110 | movi %r0 $(t0 + $offus) | |
111 | str_s %r0 %r1 | |
112 | movi %r0 $(t0 + $offi) | |
113 | movi %r1 0x80000001 | |
114 | str_i %r0 %r1 | |
115 | #if __WORDSIZE == 64 | |
116 | movi %r0 $(t0 + $offui) | |
117 | str_i %r0 %r1 | |
118 | movi %r0 $(t0 + $offl) | |
119 | movi %r1 0x8000000000000001 | |
120 | str_l %r0 %r1 | |
121 | #endif | |
122 | movi %r0 $(t0 + $offf) | |
123 | movi_f %f0 0.5 | |
124 | str_f %r0 %f0 | |
125 | movi %r0 $(t0 + $offd) | |
126 | movi_d %f0 0.25 | |
127 | str_d %r0 %f0 | |
128 | movi %r0 $(t0 + $offc) | |
129 | ldr_c %r1 %r0 | |
130 | beqi Lc %r1 XC | |
131 | calli @abort | |
132 | Lc: | |
133 | movi %r0 $(t0 + $offuc) | |
134 | ldr_uc %r1 %r0 | |
135 | beqi Luc %r1 0x81 | |
136 | calli @abort | |
137 | Luc: | |
138 | movi %r0 $(t0 + $offs) | |
139 | ldr_s %r1 %r0 | |
140 | beqi Ls %r1 XS | |
141 | calli @abort | |
142 | Ls: | |
143 | movi %r0 $(t0 + $offus) | |
144 | ldr_us %r1 %r0 | |
145 | beqi Lus %r1 0x8001 | |
146 | calli @abort | |
147 | Lus: | |
148 | movi %r0 $(t0 + $offi) | |
149 | ldr_i %r1 %r0 | |
150 | beqi Li %r1 XI | |
151 | calli @abort | |
152 | Li: | |
153 | #if __WORDSIZE == 64 | |
154 | movi %r0 $(t0 + $offui) | |
155 | ldr_ui %r1 %r0 | |
156 | beqi Lui %r1 0x80000001 | |
157 | calli @abort | |
158 | Lui: | |
159 | movi %r0 $(t0 + $offl) | |
160 | ldr_l %r1 %r0 | |
161 | beqi Ll %r1 0x8000000000000001 | |
162 | calli @abort | |
163 | Ll: | |
164 | #endif | |
165 | movi %r0 $(t0 + $offf) | |
166 | ldr_f %f0 %r0 | |
167 | beqi_f Lf %f0 0.5 | |
168 | calli @abort | |
169 | Lf: | |
170 | movi %r0 $(t0 + $offd) | |
171 | ldr_d %f0 %r0 | |
172 | beqi_d Ld %f0 0.25 | |
173 | calli @abort | |
174 | Ld: | |
175 | ||
176 | LDST(v0, v1, v2, r0, r1, r2, f0, f1, f2, f3, f4, f5) | |
177 | // just to know did not abort | |
178 | prepare | |
179 | pushargi ok | |
180 | ellipsis | |
181 | finishi @printf | |
182 | ret | |
183 | epilog |