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