1 ; 7zCrcOpt.asm -- CRC32 calculation : optimized version
\r
2 ; 2021-02-07 : Igor Pavlov : Public domain
\r
17 crc_OFFS equ (REG_SIZE * 5)
\r
18 data_OFFS equ (REG_SIZE + crc_OFFS)
\r
19 size_OFFS equ (REG_SIZE + data_OFFS)
\r
21 size_OFFS equ (REG_SIZE * 5)
\r
23 table_OFFS equ (REG_SIZE + size_OFFS)
\r
24 num_VAR equ [r4 + size_OFFS]
\r
25 table_VAR equ [r4 + table_OFFS]
\r
28 SRCDAT equ rD + rN * 1 + 4 *
\r
30 CRC macro op:req, dest:req, src:req, t:req
\r
31 op dest, DWORD PTR [rT + src * 4 + 0400h * t]
\r
34 CRC_XOR macro dest:req, src:req, t:req
\r
35 CRC xor, dest, src, t
\r
38 CRC_MOV macro dest:req, src:req, t:req
\r
39 CRC mov, dest, src, t
\r
43 movzx x6, BYTE PTR [rD]
\r
52 MY_PROLOG macro crc_end:req
\r
57 mov x0, REG_ABI_PARAM_0_x ; x0 = x7
\r
58 mov rT, REG_ABI_PARAM_3 ; r5 = r1
\r
59 mov rN, REG_ABI_PARAM_2 ; r7 = r2
\r
60 mov rD, REG_ABI_PARAM_1 ; r2 = r6
\r
63 mov x0, REG_ABI_PARAM_0_x ; x0 = x1
\r
64 mov rT, REG_ABI_PARAM_3 ; r5 = r9
\r
65 mov rN, REG_ABI_PARAM_2 ; r7 = r8
\r
66 ; mov rD, REG_ABI_PARAM_1 ; r2 = r2
\r
71 mov x0, [r4 + crc_OFFS]
\r
72 mov rD, [r4 + data_OFFS]
\r
74 mov x0, REG_ABI_PARAM_0_x
\r
98 MY_EPILOG macro crc_end:req
\r
109 if (IS_X64 gt 0) and (IS_LINUX gt 0)
\r
116 MY_PROC CrcUpdateT8, 4
\r
117 MY_PROLOG crc_end_8
\r
146 MY_EPILOG crc_end_8
\r
149 MY_PROC CrcUpdateT4, 4
\r
150 MY_PROLOG crc_end_4
\r
177 MY_EPILOG crc_end_4
\r