-
Notifications
You must be signed in to change notification settings - Fork 1
/
sha256_fresh.isa
360 lines (357 loc) · 10.6 KB
/
sha256_fresh.isa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
#ifndef _SHA256_FRESH_ISA_
#define _SHA256_FRESH_ISA_
#include "rnd.isa"
#include "const.isa"
#define sha256_fresh( \
x0, x1, x2, x3, x4, x5, x6, x7, \
m0, m1, m2, m3, m4, m5, m6, m7, \
n0, n1, n2, n3, n4, n5, n6, n7, \
y0, y1, y2, y3, y4, y5, y6, y7, \
z0, z1, z2, z3, z4, z5, z6, z7, \
t0, t1, s0 \
) \
; sha256_fresh begin;; \
; x0, x1, x2, x3, x4, x5, x6, x7,;; \
; m0, m1, m2, m3, m4, m5, m6, m7,;; \
; n0, n1, n2, n3, n4, n5, n6, n7,;; \
; y0, y1, y2, y3, y4, y5, y6, y7,;; \
; z0, z1, z2, z3, z4, z5, z6, z7,;; \
; t0, t1, s0;; \
\
v_mov_b32 y0, m0;; \
v_add_i32 x3, K63, y0;; \
v_add_i32 x7, K64, y0;; \
\
\
v_mov_b32 y1, m1;; \
v_mov_b32 x2, m1;; \
v_add_i32 x2, K65, x2;; \
v_alignbit_b32 t0, x3, x3, 6;; \
v_alignbit_b32 t1, x3, x3, 11;; \
v_xor_b32 t0, t0, t1;; \
v_alignbit_b32 t1, x3, x3, 25;; \
v_xor_b32 t0, t0, t1;; \
v_add_i32 x2, x2, t0;; \
s_mov_b32 s0, K66;; \
v_mov_b32 t0, K67;; \
v_bfi_b32 t0, x3, s0, t0;; \
v_add_i32 x2, x2, t0;; \
\
v_add_i32 x6, K68, x2;; \
v_alignbit_b32 t0, x7, x7, 2;; \
v_alignbit_b32 t1, x7, x7, 13;; \
v_xor_b32 t0, t0, t1;; \
v_alignbit_b32 t1, x7, x7, 22;; \
v_xor_b32 t0, t0, t1;; \
v_add_i32 x6, x6, t0;; \
s_mov_b32 s0, K69;; \
v_mov_b32 t0, K70;; \
v_bfi_b32 t0, x7, s0, t0;; \
v_add_i32 x6, x6, t0;; \
\
\
v_mov_b32 y2, m2;; \
v_mov_b32 x1, y2;; \
v_add_i32 x1, K71, x1;; \
v_alignbit_b32 t0, x2, x2, 6;; \
v_alignbit_b32 t1, x2, x2, 11;; \
v_xor_b32 t0, t0, t1;; \
v_alignbit_b32 t1, x2, x2, 25;; \
v_xor_b32 t0, t0, t1;; \
v_add_i32 x1, x1, t0;; \
v_mov_b32 t0, K66;; \
v_bfi_b32 t0, x2, x3, t0;; \
v_add_i32 x1, x1, t0;; \
\
v_add_i32 x5, K72, x1;; \
v_alignbit_b32 t0, x6, x6, 2;; \
v_alignbit_b32 t1, x6, x6, 13;; \
v_xor_b32 t0, t0, t1;; \
v_alignbit_b32 t1, x6, x6, 22;; \
v_xor_b32 t0, t0, t1;; \
v_add_i32 x5, x5, t0;; \
v_mov_b32 t0, K73;; \
v_xor_b32 t1, x6, t0;; \
v_bfi_b32 t0, t1, x7, t0;; \
v_add_i32 x5, x5, t0;; \
\
\
v_mov_b32 y3, m3;; \
v_mov_b32 x0, y3;; \
v_add_i32 x0, K74, x0;; \
v_alignbit_b32 t0, x1, x1, 6;; \
v_alignbit_b32 t1, x1, x1, 11;; \
v_xor_b32 t0, t0, t1;; \
v_alignbit_b32 t1, x1, x1, 25;; \
v_xor_b32 t0, t0, t1;; \
v_add_i32 x0, x0, t0;; \
v_bfi_b32 t0, x1, x2, x3;; \
v_add_i32 x0, x0, t0;; \
\
v_add_i32 x4, K75, x0;; \
v_alignbit_b32 t0, x5, x5, 2;; \
v_alignbit_b32 t1, x5, x5, 13;; \
v_xor_b32 t0, t0, t1;; \
v_alignbit_b32 t1, x5, x5, 22;; \
v_xor_b32 t0, t0, t1;; \
v_add_i32 x4, x4, t0;; \
v_xor_b32 t0, x5, x7;; \
v_bfi_b32 t0, t0, x6, x7;; \
v_add_i32 x4, x4, t0;; \
\
\
v_mov_b32 y4, m4;; \
v_add_i32 x3, x3, y4;; \
rnd(x4, x5, x6, x7, x0, x1, x2, x3, K4, t0, t1);; \
\
v_mov_b32 y5, m5;; \
v_add_i32 x2, x2, y5;; \
rnd(x3, x4, x5, x6, x7, x0, x1, x2, K5, t0, t1);; \
\
v_mov_b32 y6, m6;; \
v_add_i32 x1, x1, y6;; \
rnd(x2, x3, x4, x5, x6, x7, x0, x1, K6, t0, t1);; \
\
v_mov_b32 y7, m7;; \
v_add_i32 x0, x0, y7;; \
rnd(x1, x2, x3, x4, x5, x6, x7, x0, K7, t0, t1);; \
\
v_mov_b32 z0, n0;; \
v_add_i32 x7, x7, z0;; \
rnd(x0, x1, x2, x3, x4, x5, x6, x7, K8, t0, t1);; \
\
v_mov_b32 z1, n1;; \
v_add_i32 x6, x6, z1;; \
rnd(x7, x0, x1, x2, x3, x4, x5, x6, K9, t0, t1);; \
\
v_mov_b32 z2, n2;; \
v_add_i32 x5, x5, z2;; \
rnd(x6, x7, x0, x1, x2, x3, x4, x5, K10, t0, t1);; \
\
v_mov_b32 z3, n3;; \
v_add_i32 x4, x4, z3;; \
rnd(x5, x6, x7, x0, x1, x2, x3, x4, K11, t0, t1);; \
\
v_mov_b32 z4, n4;; \
v_add_i32 x3, x3, z4;; \
rnd(x4, x5, x6, x7, x0, x1, x2, x3, K12, t0, t1);; \
\
v_mov_b32 z5, n5;; \
v_add_i32 x2, x2, z5;; \
rnd(x3, x4, x5, x6, x7, x0, x1, x2, K13, t0, t1);; \
\
v_mov_b32 z6, n6;; \
v_add_i32 x1, x1, z6;; \
rnd(x2, x3, x4, x5, x6, x7, x0, x1, K14, t0, t1);; \
\
v_mov_b32 z7, n7;; \
v_add_i32 x0, x0, z7;; \
rnd(x1, x2, x3, x4, x5, x6, x7, x0, K76, t0, t1);; \
\
\
wr(y0, z6, z1, y1, t0, t1);; \
v_add_i32 x7, x7, y0;; \
rnd(x0, x1, x2, x3, x4, x5, x6, x7, K15, t0, t1);; \
\
wr(y1, z7, z2, y2, t0, t1);; \
v_add_i32 x6, x6, y1;; \
rnd(x7, x0, x1, x2, x3, x4, x5, x6, K16, t0, t1);; \
\
wr(y2, y0, z3, y3, t0, t1);; \
v_add_i32 x5, x5, y2;; \
rnd(x6, x7, x0, x1, x2, x3, x4, x5, K17, t0, t1);; \
\
wr(y3, y1, z4, y4, t0, t1);; \
v_add_i32 x4, x4, y3;; \
rnd(x5, x6, x7, x0, x1, x2, x3, x4, K18, t0, t1);; \
\
wr(y4, y2, z5, y5, t0, t1);; \
v_add_i32 x3, x3, y4;; \
rnd(x4, x5, x6, x7, x0, x1, x2, x3, K19, t0, t1);; \
\
wr(y5, y3, z6, y6, t0, t1);; \
v_add_i32 x2, x2, y5;; \
rnd(x3, x4, x5, x6, x7, x0, x1, x2, K20, t0, t1);; \
\
wr(y6, y4, z7, y7, t0, t1);; \
v_add_i32 x1, x1, y6;; \
rnd(x2, x3, x4, x5, x6, x7, x0, x1, K21, t0, t1);; \
\
wr(y7, y5, y0, z0, t0, t1);; \
v_add_i32 x0, x0, y7;; \
rnd(x1, x2, x3, x4, x5, x6, x7, x0, K22, t0, t1);; \
\
wr(z0, y6, y1, z1, t0, t1);; \
v_add_i32 x7, x7, z0;; \
rnd(x0, x1, x2, x3, x4, x5, x6, x7, K23, t0, t1);; \
\
wr(z1, y7, y2, z2, t0, t1);; \
v_add_i32 x6, x6, z1;; \
rnd(x7, x0, x1, x2, x3, x4, x5, x6, K24, t0, t1);; \
\
wr(z2, z0, y3, z3, t0, t1);; \
v_add_i32 x5, x5, z2;; \
rnd(x6, x7, x0, x1, x2, x3, x4, x5, K25, t0, t1);; \
\
wr(z3, z1, y4, z4, t0, t1);; \
v_add_i32 x4, x4, z3;; \
rnd(x5, x6, x7, x0, x1, x2, x3, x4, K26, t0, t1);; \
\
wr(z4, z2, y5, z5, t0, t1);; \
v_add_i32 x3, x3, z4;; \
rnd(x4, x5, x6, x7, x0, x1, x2, x3, K27, t0, t1);; \
\
wr(z5, z3, y6, z6, t0, t1);; \
v_add_i32 x2, x2, z5;; \
rnd(x3, x4, x5, x6, x7, x0, x1, x2, K28, t0, t1);; \
\
wr(z6, z4, y7, z7, t0, t1);; \
v_add_i32 x1, x1, z6;; \
rnd(x2, x3, x4, x5, x6, x7, x0, x1, K29, t0, t1);; \
\
wr(z7, z5, z0, y0, t0, t1);; \
v_add_i32 x0, x0, z7;; \
rnd(x1, x2, x3, x4, x5, x6, x7, x0, K30, t0, t1);; \
\
\
wr(y0, z6, z1, y1, t0, t1);; \
v_add_i32 x7, x7, y0;; \
rnd(x0, x1, x2, x3, x4, x5, x6, x7, K31, t0, t1);; \
\
wr(y1, z7, z2, y2, t0, t1);; \
v_add_i32 x6, x6, y1;; \
rnd(x7, x0, x1, x2, x3, x4, x5, x6, K32, t0, t1);; \
\
wr(y2, y0, z3, y3, t0, t1);; \
v_add_i32 x5, x5, y2;; \
rnd(x6, x7, x0, x1, x2, x3, x4, x5, K33, t0, t1);; \
\
wr(y3, y1, z4, y4, t0, t1);; \
v_add_i32 x4, x4, y3;; \
rnd(x5, x6, x7, x0, x1, x2, x3, x4, K34, t0, t1);; \
\
wr(y4, y2, z5, y5, t0, t1);; \
v_add_i32 x3, x3, y4;; \
rnd(x4, x5, x6, x7, x0, x1, x2, x3, K35, t0, t1);; \
\
wr(y5, y3, z6, y6, t0, t1);; \
v_add_i32 x2, x2, y5;; \
rnd(x3, x4, x5, x6, x7, x0, x1, x2, K36, t0, t1);; \
\
wr(y6, y4, z7, y7, t0, t1);; \
v_add_i32 x1, x1, y6;; \
rnd(x2, x3, x4, x5, x6, x7, x0, x1, K37, t0, t1);; \
\
wr(y7, y5, y0, z0, t0, t1);; \
v_add_i32 x0, x0, y7;; \
rnd(x1, x2, x3, x4, x5, x6, x7, x0, K38, t0, t1);; \
\
wr(z0, y6, y1, z1, t0, t1);; \
v_add_i32 x7, x7, z0;; \
rnd(x0, x1, x2, x3, x4, x5, x6, x7, K39, t0, t1);; \
\
wr(z1, y7, y2, z2, t0, t1);; \
v_add_i32 x6, x6, z1;; \
rnd(x7, x0, x1, x2, x3, x4, x5, x6, K40, t0, t1);; \
\
wr(z2, z0, y3, z3, t0, t1);; \
v_add_i32 x5, x5, z2;; \
rnd(x6, x7, x0, x1, x2, x3, x4, x5, K41, t0, t1);; \
\
wr(z3, z1, y4, z4, t0, t1);; \
v_add_i32 x4, x4, z3;; \
rnd(x5, x6, x7, x0, x1, x2, x3, x4, K42, t0, t1);; \
\
wr(z4, z2, y5, z5, t0, t1);; \
v_add_i32 x3, x3, z4;; \
rnd(x4, x5, x6, x7, x0, x1, x2, x3, K43, t0, t1);; \
\
wr(z5, z3, y6, z6, t0, t1);; \
v_add_i32 x2, x2, z5;; \
rnd(x3, x4, x5, x6, x7, x0, x1, x2, K44, t0, t1);; \
\
wr(z6, z4, y7, z7, t0, t1);; \
v_add_i32 x1, x1, z6;; \
rnd(x2, x3, x4, x5, x6, x7, x0, x1, K45, t0, t1);; \
\
wr(z7, z5, z0, y0, t0, t1);; \
v_add_i32 x0, x0, z7;; \
rnd(x1, x2, x3, x4, x5, x6, x7, x0, K46, t0, t1);; \
\
\
wr(y0, z6, z1, y1, t0, t1);; \
v_add_i32 x7, x7, y0;; \
rnd(x0, x1, x2, x3, x4, x5, x6, x7, K47, t0, t1);; \
\
wr(y1, z7, z2, y2, t0, t1);; \
v_add_i32 x6, x6, y1;; \
rnd(x7, x0, x1, x2, x3, x4, x5, x6, K48, t0, t1);; \
\
wr(y2, y0, z3, y3, t0, t1);; \
v_add_i32 x5, x5, y2;; \
rnd(x6, x7, x0, x1, x2, x3, x4, x5, K49, t0, t1);; \
\
wr(y3, y1, z4, y4, t0, t1);; \
v_add_i32 x4, x4, y3;; \
rnd(x5, x6, x7, x0, x1, x2, x3, x4, K50, t0, t1);; \
\
wr(y4, y2, z5, y5, t0, t1);; \
v_add_i32 x3, x3, y4;; \
rnd(x4, x5, x6, x7, x0, x1, x2, x3, K51, t0, t1);; \
\
wr(y5, y3, z6, y6, t0, t1);; \
v_add_i32 x2, x2, y5;; \
rnd(x3, x4, x5, x6, x7, x0, x1, x2, K52, t0, t1);; \
\
wr(y6, y4, z7, y7, t0, t1);; \
v_add_i32 x1, x1, y6;; \
rnd(x2, x3, x4, x5, x6, x7, x0, x1, K53, t0, t1);; \
\
wr(y7, y5, y0, z0, t0, t1);; \
v_add_i32 x0, x0, y7;; \
rnd(x1, x2, x3, x4, x5, x6, x7, x0, K54, t0, t1);; \
\
wr(z0, y6, y1, z1, t0, t1);; \
v_add_i32 x7, x7, z0;; \
rnd(x0, x1, x2, x3, x4, x5, x6, x7, K55, t0, t1);; \
\
wr(z1, y7, y2, z2, t0, t1);; \
v_add_i32 x6, x6, z1;; \
rnd(x7, x0, x1, x2, x3, x4, x5, x6, K56, t0, t1);; \
\
wr(z2, z0, y3, z3, t0, t1);; \
v_add_i32 x5, x5, z2;; \
rnd(x6, x7, x0, x1, x2, x3, x4, x5, K57, t0, t1);; \
\
wr(z3, z1, y4, z4, t0, t1);; \
v_add_i32 x4, x4, z3;; \
rnd(x5, x6, x7, x0, x1, x2, x3, x4, K58, t0, t1);; \
\
wr(z4, z2, y5, z5, t0, t1);; \
v_add_i32 x3, x3, z4;; \
rnd(x4, x5, x6, x7, x0, x1, x2, x3, K59, t0, t1);; \
\
wr(z5, z3, y6, z6, t0, t1);; \
v_add_i32 x2, x2, z5;; \
rnd(x3, x4, x5, x6, x7, x0, x1, x2, K60, t0, t1);; \
\
wr(z6, z4, y7, z7, t0, t1);; \
v_add_i32 x1, x1, z6;; \
rnd(x2, x3, x4, x5, x6, x7, x0, x1, K61, t0, t1);; \
\
wr(z7, z5, z0, y0, t0, t1);; \
v_add_i32 x0, x0, z7;; \
rnd(x1, x2, x3, x4, x5, x6, x7, x0, K62, t0, t1);; \
\
\
v_add_i32 x0, K73, x0;; \
v_add_i32 x1, K77, x1;; \
v_add_i32 x2, K78, x2;; \
v_add_i32 x3, K79, x3;; \
v_add_i32 x4, K66, x4;; \
v_add_i32 x5, K67, x5;; \
v_add_i32 x6, K80, x6;; \
v_add_i32 x7, K81, x7;; \
\
; sha256_fresh end
#endif