Commit | Line | Data |
---|---|---|
4a71579b PC |
1 | #include "ldst.inc" |
2 | ||
3 | #if __WORDSIZE == 64 | |
4 | # define LDSTL(N, R0) \ | |
5 | sti_i ui0 %R0 \ | |
6 | movi %R0 L##N \ | |
7 | sti_l l0 %R0 | |
8 | ||
9 | # define SI(C, N, x, X, R0) \ | |
10 | ldi_##x %R0 x##0 \ | |
11 | beqi L##x##C %R0 L##X##N \ | |
12 | calli @abort \ | |
13 | L##x##C: | |
14 | ||
15 | # define LDRL(C, N, R0) \ | |
16 | UI(C, N, i, I, R0) \ | |
17 | SI(C, N, l, L, R0) | |
18 | #else | |
19 | # define LDSTL(C, R0) | |
20 | # define SI(C, N, x, X, R0) \ | |
21 | ldi_##x %R0 x##0 \ | |
22 | beqi L##x##C %R0 I##X##N \ | |
23 | calli @abort \ | |
24 | L##x##C: | |
25 | ||
26 | # define LDRL(C, N, R0) | |
27 | ||
28 | #endif | |
29 | ||
30 | #define UI(C, N, x, X, R0) \ | |
31 | ldi_u##x %R0 u##x##0 \ | |
32 | beqi Lu##x##C %R0 X##N \ | |
33 | calli @abort \ | |
34 | Lu##x##C: | |
35 | ||
36 | #define FF(C, N, x, X, F0) \ | |
37 | ldi_##x %F0 x##0 \ | |
38 | beqi_##x L##x##C %F0 X##N \ | |
39 | L##x##C: | |
40 | ||
41 | #define LDST1(X, N, R0, F0) \ | |
42 | movi %R0 C##N \ | |
43 | sti_c c0 %R0 \ | |
44 | sti_c uc0 %R0 \ | |
45 | movi %R0 S##N \ | |
46 | sti_s s0 %R0 \ | |
47 | sti_s us0 %R0 \ | |
48 | movi %R0 I##N \ | |
49 | sti_i i0 %R0 \ | |
50 | LDSTL(N, R0) \ | |
51 | movi_f %F0 F##N \ | |
52 | sti_f f0 %F0 \ | |
53 | movi_d %F0 D##N \ | |
54 | sti_d d0 %F0 \ | |
55 | SI(X, N, c, C, R0) \ | |
56 | UI(X, N, c, C, R0) \ | |
57 | SI(X, N, s, S, R0) \ | |
58 | UI(X, N, s, S, R0) \ | |
59 | SI(X, N, i, I, R0) \ | |
60 | LDRL(X, N, R0) \ | |
61 | FF(X, N, f, F, F0) \ | |
62 | FF(X, N, d, D, F0) | |
63 | ||
64 | #define LDST0(R0, F0) \ | |
65 | LDST1(0_##R0##_##F0, 0, R0, F0) \ | |
66 | LDST1(1_##R0##_##F0, 1, R0, F0) \ | |
67 | LDST1(2_##R0##_##F0, 2, R0, F0) \ | |
68 | LDST1(3_##R0##_##F0, 3, R0, F0) | |
69 | ||
70 | #define LDST(V0, V1, V2, R0, R1, R2, F0, F1, F2, F3, F4, F5) \ | |
71 | LDST0(V0, F0) \ | |
72 | LDST0(V1, F1) \ | |
73 | LDST0(V2, F3) \ | |
74 | LDST0(R0, F4) \ | |
75 | LDST0(R1, F5) \ | |
76 | LDST0(R2, F0) | |
77 | ||
78 | .code | |
79 | prolog | |
80 | ||
81 | /* Simple test to simplify validating encodings before | |
82 | * brute force tests */ | |
83 | movi %r1 0x81 | |
84 | sti_c c0 %r1 | |
85 | sti_c uc0 %r1 | |
86 | movi %r1 0x8001 | |
87 | sti_s s0 %r1 | |
88 | sti_s us0 %r1 | |
89 | movi %r1 0x80000001 | |
90 | sti_i i0 %r1 | |
91 | #if __WORDSIZE == 64 | |
92 | sti_i ui0 %r1 | |
93 | movi %r1 0x8000000000000001 | |
94 | sti_l l0 %r1 | |
95 | #endif | |
96 | movi_f %f0 0.5 | |
97 | sti_f f0 %f0 | |
98 | movi_d %f0 0.25 | |
99 | sti_d d0 %f0 | |
100 | ldi_c %r1 c0 | |
101 | beqi Lc %r1 XC | |
102 | calli @abort | |
103 | Lc: | |
104 | ldi_uc %r1 uc0 | |
105 | beqi Luc %r1 0x81 | |
106 | calli @abort | |
107 | Luc: | |
108 | ldi_s %r1 s0 | |
109 | beqi Ls %r1 XS | |
110 | calli @abort | |
111 | Ls: | |
112 | ldi_us %r1 us0 | |
113 | beqi Lus %r1 0x8001 | |
114 | calli @abort | |
115 | Lus: | |
116 | ldi_i %r1 i0 | |
117 | beqi Li %r1 XI | |
118 | calli @abort | |
119 | Li: | |
120 | #if __WORDSIZE == 64 | |
121 | ldi_ui %r1 ui0 | |
122 | beqi Lui %r1 0x80000001 | |
123 | calli @abort | |
124 | Lui: | |
125 | ldi_l %r1 l0 | |
126 | beqi Ll %r1 0x8000000000000001 | |
127 | calli @abort | |
128 | Ll: | |
129 | #endif | |
130 | ldi_f %f0 f0 | |
131 | beqi_f Lf %f0 0.5 | |
132 | calli @abort | |
133 | Lf: | |
134 | ldi_d %f0 d0 | |
135 | beqi_d Ld %f0 0.25 | |
136 | calli @abort | |
137 | Ld: | |
138 | ||
139 | LDST(v0, v1, v2, r0, r1, r2, f0, f1, f2, f3, f4, f5) | |
140 | // just to know did not abort | |
141 | prepare | |
142 | pushargi ok | |
143 | ellipsis | |
144 | finishi @printf | |
145 | ret | |
146 | epilog |