1 ; XzCrc64Opt.asm -- CRC64 calculation : optimized version
\r
2 ; 2021-02-06 : Igor Pavlov : Public domain
\r
15 SRCDAT4 equ dword ptr [rD + rN * 1]
\r
17 CRC_XOR macro dest:req, src:req, t:req
\r
18 xor dest, QWORD PTR [rT + src * 8 + 0800h * t]
\r
22 movzx x6, BYTE PTR [rD]
\r
31 MY_PROLOG macro crc_end:req
\r
37 mov r0, REG_ABI_PARAM_0
\r
38 mov rN, REG_ABI_PARAM_2
\r
39 mov rT, REG_ABI_PARAM_3
\r
40 mov rD, REG_ABI_PARAM_1
\r
61 MY_EPILOG macro crc_end:req
\r
81 MY_PROC XzCrc64UpdateT4, 4
\r
101 MY_EPILOG crc_end_4
\r
111 crc_OFFS equ (REG_SIZE * 5)
\r
113 if (IS_CDECL gt 0) or (IS_LINUX gt 0)
\r
114 ; cdecl or (GNU fastcall) stack:
\r
120 data_OFFS equ (8 + crc_OFFS)
\r
121 size_OFFS equ (REG_SIZE + data_OFFS)
\r
122 table_OFFS equ (REG_SIZE + size_OFFS)
\r
123 num_VAR equ [r4 + size_OFFS]
\r
124 table_VAR equ [r4 + table_OFFS]
\r
126 ; Windows fastcall:
\r
127 ; r1 = data, r2 = size
\r
132 table_OFFS equ (8 + crc_OFFS)
\r
133 table_VAR equ [r4 + table_OFFS]
\r
134 num_VAR equ table_VAR
\r
137 SRCDAT4 equ dword ptr [rD + rN * 1]
\r
139 CRC macro op0:req, op1:req, dest0:req, dest1:req, src:req, t:req
\r
140 op0 dest0, DWORD PTR [rT + src * 8 + 0800h * t]
\r
141 op1 dest1, DWORD PTR [rT + src * 8 + 0800h * t + 4]
\r
144 CRC_XOR macro dest0:req, dest1:req, src:req, t:req
\r
145 CRC xor, xor, dest0, dest1, src, t
\r
150 movzx x6, BYTE PTR [rD]
\r
156 CRC_XOR r0, r2, r6, 0
\r
160 MY_PROLOG macro crc_end:req
\r
163 if (IS_CDECL gt 0) or (IS_LINUX gt 0)
\r
164 proc_numParams = proc_numParams + 2 ; for ABI_LINUX
\r
165 mov rN, [r4 + size_OFFS]
\r
166 mov rD, [r4 + data_OFFS]
\r
171 mov x0, [r4 + crc_OFFS]
\r
172 mov x2, [r4 + crc_OFFS + 4]
\r
195 MY_EPILOG macro crc_end:req
\r
211 MY_PROC XzCrc64UpdateT4, 5
\r
212 MY_PROLOG crc_end_4
\r
219 CRC xor, mov, r3, r2, r6, 3
\r
222 CRC_XOR r3, r2, r6, 2
\r
226 CRC_XOR r3, r2, r6, 1
\r
227 CRC_XOR r3, r2, r0, 0
\r
234 MY_EPILOG crc_end_4
\r