]> git.proxmox.com Git - ceph.git/blob - ceph/src/isa-l/igzip/igzip_deflate_hash.asm
bump version to 18.2.2-pve1
[ceph.git] / ceph / src / isa-l / igzip / igzip_deflate_hash.asm
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ; Copyright(c) 2011-2018 Intel Corporation All rights reserved.
3 ;
4 ; Redistribution and use in source and binary forms, with or without
5 ; modification, are permitted provided that the following conditions
6 ; are met:
7 ; * Redistributions of source code must retain the above copyright
8 ; notice, this list of conditions and the following disclaimer.
9 ; * Redistributions in binary form must reproduce the above copyright
10 ; notice, this list of conditions and the following disclaimer in
11 ; the documentation and/or other materials provided with the
12 ; distribution.
13 ; * Neither the name of Intel Corporation nor the names of its
14 ; contributors may be used to endorse or promote products derived
15 ; from this software without specific prior written permission.
16 ;
17 ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 ; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 ; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 ; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 ; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 ; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 ; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 ; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 ; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
29
30 %include "options.asm"
31 %include "lz0a_const.asm"
32 %include "data_struct2.asm"
33 %include "huffman.asm"
34 %include "reg_sizes.asm"
35
36 %define DICT_SLOP 8
37 %define DICT_END_SLOP 4
38
39 %ifidn __OUTPUT_FORMAT__, win64
40 %define arg1 rcx
41 %define arg2 rdx
42 %define arg3 r8
43 %define arg4 r9
44 %define arg5 rdi
45 %define swap1 rsi
46 %define stack_size 3 * 8
47 %define PS 8
48 %define arg(x) [rsp + stack_size + PS*x]
49 %else
50 %define arg1 rdi
51 %define arg2 rsi
52 %define arg3 rdx
53 %define arg4 rcx
54 %define arg5 r8
55 %define swap1 r9
56 %endif
57
58 %define hash_table arg1
59
60 %define hash_mask arg2
61
62 %define f_i_end arg3
63
64 %define dict_offset arg4
65
66 %define dict_len arg5
67 %define f_i arg5
68
69 %define f_i_tmp rax
70
71 %define hash swap1
72
73 %define hash2 r10
74
75 %define hash3 r11
76
77 %define hash4 r12
78
79
80 %macro FUNC_SAVE 0
81 %ifidn __OUTPUT_FORMAT__, win64
82 push rsi
83 push rdi
84 push r12
85 mov arg5 %+ d, arg(5)
86 %else
87 push r12
88 %endif
89 %endm
90
91 %macro FUNC_RESTORE 0
92 %ifidn __OUTPUT_FORMAT__, win64
93 pop r12
94 pop rdi
95 pop rsi
96 %else
97 pop r12
98 %endif
99 %endm
100
101 [bits 64]
102 default rel
103 section .text
104
105 global isal_deflate_hash_crc_01
106 isal_deflate_hash_crc_01:
107 endbranch
108 FUNC_SAVE
109
110 neg f_i
111 add f_i, f_i_end
112
113 sub dict_offset, f_i
114
115 sub f_i_end, DICT_SLOP
116 cmp f_i, f_i_end
117 jg end_main
118
119 main_loop:
120 lea f_i_tmp, [f_i + 2]
121
122 xor hash, hash
123 crc32 hash %+ d, dword [f_i + dict_offset]
124
125 xor hash2, hash2
126 crc32 hash2 %+ d, dword [f_i + dict_offset + 1]
127
128 xor hash3, hash3
129 crc32 hash3 %+ d, dword [f_i_tmp + dict_offset]
130
131 xor hash4, hash4
132 crc32 hash4 %+ d, dword [f_i_tmp + dict_offset + 1]
133
134 and hash, hash_mask
135 and hash2, hash_mask
136 and hash3, hash_mask
137 and hash4, hash_mask
138
139 mov [hash_table + 2 * hash], f_i %+ w
140 add f_i, 1
141
142 mov [hash_table + 2 * hash2], f_i %+ w
143 add f_i, 3
144
145 mov [hash_table + 2 * hash3], f_i_tmp %+ w
146 add f_i_tmp, 1
147
148 mov [hash_table + 2 * hash4], f_i_tmp %+ w
149
150 cmp f_i, f_i_end
151 jle main_loop
152
153 end_main:
154 add f_i_end, DICT_SLOP - DICT_END_SLOP
155 cmp f_i, f_i_end
156 jg end
157
158 end_loop:
159 xor hash, hash
160 crc32 hash %+ d, dword [f_i + dict_offset]
161
162 and hash, hash_mask
163 mov [hash_table + 2 * hash], f_i %+ w
164
165 add f_i, 1
166 cmp f_i, f_i_end
167 jle end_loop
168 end:
169 FUNC_RESTORE
170 ret