2018-06-21 23:50:40 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; Copyright(c) 2011-2018 Intel Corporation All rights reserved.
|
|
|
|
;
|
|
|
|
; Redistribution and use in source and binary forms, with or without
|
|
|
|
; modification, are permitted provided that the following conditions
|
|
|
|
; are met:
|
|
|
|
; * Redistributions of source code must retain the above copyright
|
|
|
|
; notice, this list of conditions and the following disclaimer.
|
|
|
|
; * Redistributions in binary form must reproduce the above copyright
|
|
|
|
; notice, this list of conditions and the following disclaimer in
|
|
|
|
; the documentation and/or other materials provided with the
|
|
|
|
; distribution.
|
|
|
|
; * Neither the name of Intel Corporation nor the names of its
|
|
|
|
; contributors may be used to endorse or promote products derived
|
|
|
|
; from this software without specific prior written permission.
|
|
|
|
;
|
|
|
|
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
2017-06-07 22:40:34 +02:00
|
|
|
%include "options.asm"
|
|
|
|
%include "lz0a_const.asm"
|
|
|
|
%include "data_struct2.asm"
|
|
|
|
%include "huffman.asm"
|
|
|
|
%include "reg_sizes.asm"
|
|
|
|
|
2017-06-09 23:00:01 +02:00
|
|
|
%define DICT_SLOP 8
|
|
|
|
%define DICT_END_SLOP 4
|
2017-06-07 22:40:34 +02:00
|
|
|
|
|
|
|
%ifidn __OUTPUT_FORMAT__, win64
|
|
|
|
%define arg1 rcx
|
|
|
|
%define arg2 rdx
|
|
|
|
%define arg3 r8
|
2017-11-17 18:22:18 +01:00
|
|
|
%define arg4 r9
|
|
|
|
%define arg5 rdi
|
|
|
|
%define swap1 rsi
|
|
|
|
%define stack_size 3 * 8
|
|
|
|
%define PS 8
|
|
|
|
%define arg(x) [rsp + stack_size + PS*x]
|
2017-06-07 22:40:34 +02:00
|
|
|
%else
|
|
|
|
%define arg1 rdi
|
|
|
|
%define arg2 rsi
|
|
|
|
%define arg3 rdx
|
2017-11-17 18:22:18 +01:00
|
|
|
%define arg4 rcx
|
|
|
|
%define arg5 r8
|
|
|
|
%define swap1 r9
|
2017-06-07 22:40:34 +02:00
|
|
|
%endif
|
|
|
|
|
2017-11-17 18:22:18 +01:00
|
|
|
%define hash_table arg1
|
2017-06-07 22:40:34 +02:00
|
|
|
|
2017-11-17 18:22:18 +01:00
|
|
|
%define hash_mask arg2
|
2017-06-07 22:40:34 +02:00
|
|
|
|
2017-11-17 18:22:18 +01:00
|
|
|
%define f_i_end arg3
|
2017-06-07 22:40:34 +02:00
|
|
|
|
2017-11-17 18:22:18 +01:00
|
|
|
%define dict_offset arg4
|
2017-06-07 22:40:34 +02:00
|
|
|
|
2017-11-17 18:22:18 +01:00
|
|
|
%define dict_len arg5
|
|
|
|
%define f_i arg5
|
2017-06-07 22:40:34 +02:00
|
|
|
|
2017-11-17 18:22:18 +01:00
|
|
|
%define f_i_tmp rax
|
2017-06-09 23:00:01 +02:00
|
|
|
|
2017-11-17 18:22:18 +01:00
|
|
|
%define hash swap1
|
2017-06-09 23:00:01 +02:00
|
|
|
|
2017-11-17 18:22:18 +01:00
|
|
|
%define hash2 r10
|
|
|
|
|
|
|
|
%define hash3 r11
|
|
|
|
|
|
|
|
%define hash4 r12
|
2017-06-09 23:00:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
%macro FUNC_SAVE 0
|
|
|
|
%ifidn __OUTPUT_FORMAT__, win64
|
|
|
|
push rsi
|
|
|
|
push rdi
|
2017-11-17 18:22:18 +01:00
|
|
|
push r12
|
|
|
|
mov arg5 %+ d, arg(5)
|
|
|
|
%else
|
|
|
|
push r12
|
2017-06-09 23:00:01 +02:00
|
|
|
%endif
|
|
|
|
%endm
|
|
|
|
|
|
|
|
%macro FUNC_RESTORE 0
|
|
|
|
%ifidn __OUTPUT_FORMAT__, win64
|
2017-11-17 18:22:18 +01:00
|
|
|
pop r12
|
2017-06-09 23:00:01 +02:00
|
|
|
pop rdi
|
|
|
|
pop rsi
|
2017-11-17 18:22:18 +01:00
|
|
|
%else
|
|
|
|
pop r12
|
2017-06-09 23:00:01 +02:00
|
|
|
%endif
|
|
|
|
%endm
|
2017-06-07 22:40:34 +02:00
|
|
|
|
2020-03-17 00:23:55 +01:00
|
|
|
[bits 64]
|
|
|
|
default rel
|
|
|
|
section .text
|
|
|
|
|
2017-11-17 18:22:18 +01:00
|
|
|
global isal_deflate_hash_crc_01
|
|
|
|
isal_deflate_hash_crc_01:
|
2020-05-22 19:46:50 +02:00
|
|
|
endbranch
|
2017-06-09 23:00:01 +02:00
|
|
|
FUNC_SAVE
|
|
|
|
|
2017-06-07 22:40:34 +02:00
|
|
|
neg f_i
|
|
|
|
add f_i, f_i_end
|
|
|
|
|
|
|
|
sub dict_offset, f_i
|
|
|
|
|
|
|
|
sub f_i_end, DICT_SLOP
|
|
|
|
cmp f_i, f_i_end
|
2017-06-09 23:00:01 +02:00
|
|
|
jg end_main
|
2017-06-07 22:40:34 +02:00
|
|
|
|
|
|
|
main_loop:
|
2017-06-09 23:00:01 +02:00
|
|
|
lea f_i_tmp, [f_i + 2]
|
|
|
|
|
|
|
|
xor hash, hash
|
|
|
|
crc32 hash %+ d, dword [f_i + dict_offset]
|
|
|
|
|
|
|
|
xor hash2, hash2
|
|
|
|
crc32 hash2 %+ d, dword [f_i + dict_offset + 1]
|
|
|
|
|
|
|
|
xor hash3, hash3
|
|
|
|
crc32 hash3 %+ d, dword [f_i_tmp + dict_offset]
|
|
|
|
|
|
|
|
xor hash4, hash4
|
|
|
|
crc32 hash4 %+ d, dword [f_i_tmp + dict_offset + 1]
|
|
|
|
|
2017-11-17 18:22:18 +01:00
|
|
|
and hash, hash_mask
|
|
|
|
and hash2, hash_mask
|
|
|
|
and hash3, hash_mask
|
|
|
|
and hash4, hash_mask
|
2017-06-07 22:40:34 +02:00
|
|
|
|
2017-11-17 18:22:18 +01:00
|
|
|
mov [hash_table + 2 * hash], f_i %+ w
|
2017-06-07 22:40:34 +02:00
|
|
|
add f_i, 1
|
2017-06-09 23:00:01 +02:00
|
|
|
|
2017-11-17 18:22:18 +01:00
|
|
|
mov [hash_table + 2 * hash2], f_i %+ w
|
2017-06-09 23:00:01 +02:00
|
|
|
add f_i, 3
|
|
|
|
|
2017-11-17 18:22:18 +01:00
|
|
|
mov [hash_table + 2 * hash3], f_i_tmp %+ w
|
2017-06-09 23:00:01 +02:00
|
|
|
add f_i_tmp, 1
|
|
|
|
|
2017-11-17 18:22:18 +01:00
|
|
|
mov [hash_table + 2 * hash4], f_i_tmp %+ w
|
2017-06-09 23:00:01 +02:00
|
|
|
|
2017-06-07 22:40:34 +02:00
|
|
|
cmp f_i, f_i_end
|
|
|
|
jle main_loop
|
2017-06-09 23:00:01 +02:00
|
|
|
|
|
|
|
end_main:
|
|
|
|
add f_i_end, DICT_SLOP - DICT_END_SLOP
|
|
|
|
cmp f_i, f_i_end
|
|
|
|
jg end
|
|
|
|
|
|
|
|
end_loop:
|
|
|
|
xor hash, hash
|
|
|
|
crc32 hash %+ d, dword [f_i + dict_offset]
|
|
|
|
|
2017-11-17 18:22:18 +01:00
|
|
|
and hash, hash_mask
|
|
|
|
mov [hash_table + 2 * hash], f_i %+ w
|
2017-06-09 23:00:01 +02:00
|
|
|
|
|
|
|
add f_i, 1
|
|
|
|
cmp f_i, f_i_end
|
|
|
|
jle end_loop
|
2017-06-07 22:40:34 +02:00
|
|
|
end:
|
2017-06-09 23:00:01 +02:00
|
|
|
FUNC_RESTORE
|
2017-06-07 22:40:34 +02:00
|
|
|
ret
|