gpu_neon: fix some missing ebuf updates
[pcsx_rearmed.git] / deps / lightning / check / hton.tst
CommitLineData
4a71579b
PC
1.data 16
2ok:
3.c "ok\n"
4
5#define us12_i 0x1234
6#define us7f_i 0x7ff7
7#define us80_i 0x8008
8#define usff_i 0xffff
9#define ui12_i 0x01234567
10#define ui7f_i 0x7f7ff7f7
11#define ui80_i 0x80800808
12#define uiff_i 0xffffffff
13#define ul12_i 0x0123456789abcdef
14#define ul7f_i 0x7f7f7f7ff7f7f7f7
15#define ul80_i 0x8080808008080808
16#define ulff_i 0xffffffffffffffff
17
18#if __WORDSIZE == 32
19# define xus12_i 0xffff1234
20# define xus7f_i 0x10107ff7
21# define xus80_i 0x81188008
22# define xusff_i 0xeaaeffff
23#else
24# define xus12_i 0xffffffffffff1234
25# define xus7f_i 0x1010100101017ff7
26# define xus80_i 0x8181811818818008
27# define xusff_i 0xeaeaeaaeaeaeffff
28# define xui12_i 0xffffffff01234567
29# define xui7f_i 0x101001017f7ff7f7
30# define xui80_i 0x8181181880800808
31# define xuiff_i 0xeaeaaeaeffffffff
32#endif
33
34#if __BYTE_ORDER == __LITTLE_ENDIAN
35# define us12_o 0x3412
36# define us7f_o 0xf77f
37# define us80_o 0x0880
38# define usff_o 0xffff
39# define ui12_o 0x67452301
40# define ui7f_o 0xf7f77f7f
41# define ui80_o 0x08088080
42# define uiff_o 0xffffffff
43# define ul12_o 0xefcdab8967452301
44# define ul7f_o 0xf7f7f7f77f7f7f7f
45# define ul80_o 0x0808080880808080
46# define ulff_o 0xffffffffffffffff
47#else
48# define us12_o us12_i
49# define us7f_o us7f_i
50# define us80_o us80_i
51# define usff_o usff_i
52# define ui12_o ui12_i
53# define ui7f_o ui7f_i
54# define ui80_o ui80_i
55# define uiff_o uiff_i
56# define ul12_o ul12_i
57# define ul7f_o ul7f_i
58# define ul80_o ul80_i
59# define ulff_o ulff_i
60#endif
61
62#define HTON4(I, O, T, R0, R1) \
63 movi %R0 I \
64 htonr_##T %R1 %R0 \
65 beqi T##R0##R1##I %R1 O \
66 calli @abort \
67T##R0##R1##I:
68
69#define HTON3(T, R0, R1) \
70 HTON4(T##12_i, T##12_o, T, R0, R1) \
71 HTON4(x##T##12_i, T##12_o, T, R0, R1) \
72 HTON4(T##7f_i, T##7f_o, T, R0, R1) \
73 HTON4(x##T##7f_i, T##7f_o, T, R0, R1) \
74 HTON4(T##80_i, T##80_o, T, R0, R1) \
75 HTON4(x##T##80_i, T##80_o, T, R0, R1) \
76 HTON4(T##ff_i, T##ff_o, T, R0, R1) \
77 HTON4(x##T##ff_i, T##ff_o, T, R0, R1)
78
79#define HTON3x(T, R0, R1) \
80 HTON4(T##12_i, T##12_o, T, R0, R1) \
81 HTON4(T##7f_i, T##7f_o, T, R0, R1) \
82 HTON4(T##80_i, T##80_o, T, R0, R1) \
83 HTON4(T##ff_i, T##ff_o, T, R0, R1)
84
85#define HTON2(T, V0, V1, V2, R0, R1, R2) \
86 HTON3(T, V0, V0) \
87 HTON3(T, V0, V1) \
88 HTON3(T, V0, V2) \
89 HTON3(T, V0, R0) \
90 HTON3(T, V0, R1) \
91 HTON3(T, V0, R2) \
92
93#define HTON2x(T, V0, V1, V2, R0, R1, R2) \
94 HTON3x(T, V0, V0) \
95 HTON3x(T, V0, V1) \
96 HTON3x(T, V0, V2) \
97 HTON3x(T, V0, R0) \
98 HTON3x(T, V0, R1) \
99 HTON3x(T, V0, R2) \
100
101#define HTON1(T, V0, V1, V2, R0, R1, R2) \
102 HTON2(T, V0, V1, V2, R0, R1, R2) \
103 HTON2(T, V1, V2, R0, R1, R2, V0) \
104 HTON2(T, V2, R0, R1, R2, V0, V1) \
105 HTON2(T, R0, R1, R2, V0, V1, V2) \
106 HTON2(T, R1, R2, V0, V1, V2, R0) \
107 HTON2(T, R2, V0, V1, V2, R0, R1)
108
109#define HTON1x(T, V0, V1, V2, R0, R1, R2) \
110 HTON2x(T, V0, V1, V2, R0, R1, R2) \
111 HTON2x(T, V1, V2, R0, R1, R2, V0) \
112 HTON2x(T, V2, R0, R1, R2, V0, V1) \
113 HTON2x(T, R0, R1, R2, V0, V1, V2) \
114 HTON2x(T, R1, R2, V0, V1, V2, R0) \
115 HTON2x(T, R2, V0, V1, V2, R0, R1)
116
117#if __WORDSIZE == 32
118# define HTON(V0, V1, V2, R0, R1, R2) \
119 HTON1(us, V0, V1, V2, R0, R1, R2) \
120 HTON1x(ui, V0, V1, V2, R0, R1, R2)
121#else
122# define HTON(V0, V1, V2, R0, R1, R2) \
123 HTON1(us, V0, V1, V2, R0, R1, R2) \
124 HTON1(ui, V0, V1, V2, R0, R1, R2) \
125 HTON1x(ul, V0, V1, V2, R0, R1, R2)
126#endif
127
128.code
129 prolog
130 /* simple sequence for easier disassembly reading and encoding check */
131 movi %r0 us12_i
132 htonr_us %r1 %r0
133 beqi us %r1 us12_o
134 calli @abort
135us:
136
137 movi %r0 xus12_i
138 htonr_us %r1 %r0
139 beqi xus %r1 us12_o
140 calli @abort
141xus:
142 movi %r0 ui12_i
143 htonr_ui %r1 %r0
144 beqi ui %r1 ui12_o
145 calli @abort
146ui:
147#if __WORDSIZE == 64
148 movi %r0 xui12_i
149 htonr_ui %r1 %r0
150 beqi xui %r1 ui12_o
151 calli @abort
152xui:
153 movi %r0 ul12_i
154 htonr_ul %r1 %r0
155 beqi ul %r1 ul12_o
156 calli @abort
157ul:
158#endif
159
160 HTON(v0, v1, v2, r0, r1, r2)
161
162 // just to know did not abort
163 prepare
164 pushargi ok
165 ellipsis
166 finishi @printf
167
168 ret
169 epilog