mirror of
https://github.com/intel/isa-l.git
synced 2024-12-13 09:52:56 +01:00
igzip: Remove DECLARE_ALIGNED and optimize structure layout
Change-Id: I95bc3b8e2e30aff0d596c743158337400c4eb486 Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
This commit is contained in:
parent
a7fad4b9d2
commit
80bfbb33df
@ -119,23 +119,23 @@ FIELD _icf_buf_start, 0, 0
|
|||||||
START_FIELDS ;; isal_zstate
|
START_FIELDS ;; isal_zstate
|
||||||
|
|
||||||
;; name size align
|
;; name size align
|
||||||
FIELD _b_bytes_valid, 4, 4
|
|
||||||
FIELD _b_bytes_processed, 4, 4
|
|
||||||
FIELD _file_start, 8, 8
|
FIELD _file_start, 8, 8
|
||||||
FIELD _crc, 4, 4
|
|
||||||
FIELD _bitbuf, _BitBuf2_size, _BitBuf2_align
|
FIELD _bitbuf, _BitBuf2_size, _BitBuf2_align
|
||||||
|
FIELD _crc, 4, 4
|
||||||
FIELD _state, 4, 4
|
FIELD _state, 4, 4
|
||||||
|
FIELD _has_wrap_hdr, 2, 2
|
||||||
|
FIELD _has_eob_hdr, 2, 2
|
||||||
|
FIELD _has_eob, 2, 2
|
||||||
|
FIELD _has_hist, 2, 2
|
||||||
|
FIELD _hist, _isal_mod_hist_size, _isal_mod_hist_align
|
||||||
FIELD _count, 4, 4
|
FIELD _count, 4, 4
|
||||||
FIELD _tmp_out_buff, 16, 1
|
FIELD _tmp_out_buff, 16, 1
|
||||||
FIELD _tmp_out_start, 4, 4
|
FIELD _tmp_out_start, 4, 4
|
||||||
FIELD _tmp_out_end, 4, 4
|
FIELD _tmp_out_end, 4, 4
|
||||||
FIELD _has_wrap_hdr, 4, 4
|
FIELD _b_bytes_valid, 4, 4
|
||||||
FIELD _has_eob, 4, 4
|
FIELD _b_bytes_processed, 4, 4
|
||||||
FIELD _has_eob_hdr, 4, 4
|
FIELD _buffer, BSIZE, 1
|
||||||
FIELD _has_hist, 4, 4
|
FIELD _head, IGZIP_HASH_SIZE*2, 2
|
||||||
FIELD _hist, _isal_mod_hist_size, _isal_mod_hist_align
|
|
||||||
FIELD _buffer, BSIZE, 32
|
|
||||||
FIELD _head, IGZIP_HASH_SIZE*2, 16
|
|
||||||
|
|
||||||
%assign _isal_zstate_size _FIELD_OFFSET
|
%assign _isal_zstate_size _FIELD_OFFSET
|
||||||
%assign _isal_zstate_align _STRUCT_ALIGN
|
%assign _isal_zstate_align _STRUCT_ALIGN
|
||||||
@ -165,8 +165,8 @@ FIELD _hufftables, 8, 8
|
|||||||
FIELD _level, 4, 4
|
FIELD _level, 4, 4
|
||||||
FIELD _level_buf_size, 4, 4
|
FIELD _level_buf_size, 4, 4
|
||||||
FIELD _level_buf, 8, 8
|
FIELD _level_buf, 8, 8
|
||||||
FIELD _end_of_stream, 4, 4
|
FIELD _end_of_stream, 2, 2
|
||||||
FIELD _flush, 4, 4
|
FIELD _flush, 2, 2
|
||||||
FIELD _gzip_flag, 4, 4
|
FIELD _gzip_flag, 4, 4
|
||||||
FIELD _internal_state, _isal_zstate_size, _isal_zstate_align
|
FIELD _internal_state, _isal_zstate_size, _isal_zstate_align
|
||||||
|
|
||||||
|
@ -137,9 +137,9 @@ isal_deflate_body_ %+ ARCH %+ :
|
|||||||
;; Set stream's next state
|
;; Set stream's next state
|
||||||
mov rdx, ZSTATE_FLUSH_READ_BUFFER
|
mov rdx, ZSTATE_FLUSH_READ_BUFFER
|
||||||
mov rax, ZSTATE_BODY
|
mov rax, ZSTATE_BODY
|
||||||
cmp dword [rcx + _end_of_stream], 0
|
cmp word [rcx + _end_of_stream], 0
|
||||||
cmovne rax, rdx
|
cmovne rax, rdx
|
||||||
cmp dword [rcx + _flush], _NO_FLUSH
|
cmp word [rcx + _flush], _NO_FLUSH
|
||||||
cmovne rax, rdx
|
cmovne rax, rdx
|
||||||
mov dword [rcx + _internal_state_state], eax
|
mov dword [rcx + _internal_state_state], eax
|
||||||
ret
|
ret
|
||||||
@ -164,7 +164,7 @@ skip1:
|
|||||||
mov [rsp + gpr_save_mem_offset + 7*8], r15
|
mov [rsp + gpr_save_mem_offset + 7*8], r15
|
||||||
|
|
||||||
mov stream, rcx
|
mov stream, rcx
|
||||||
mov dword [stream + _internal_state_has_eob], 0
|
mov word [stream + _internal_state_has_eob], 0
|
||||||
|
|
||||||
MOVDQU xmask, [mask]
|
MOVDQU xmask, [mask]
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ MARK __body_compute_hash_ %+ ARCH
|
|||||||
and hash, HASH_MASK
|
and hash, HASH_MASK
|
||||||
and hash2, HASH_MASK
|
and hash2, HASH_MASK
|
||||||
|
|
||||||
cmp dword [stream + _internal_state_has_hist], IGZIP_NO_HIST
|
cmp word [stream + _internal_state_has_hist], IGZIP_NO_HIST
|
||||||
je write_first_byte
|
je write_first_byte
|
||||||
|
|
||||||
jmp loop2
|
jmp loop2
|
||||||
@ -464,9 +464,9 @@ write_lit_bits:
|
|||||||
input_end:
|
input_end:
|
||||||
mov tmp1, ZSTATE_FLUSH_READ_BUFFER
|
mov tmp1, ZSTATE_FLUSH_READ_BUFFER
|
||||||
mov tmp5, ZSTATE_BODY
|
mov tmp5, ZSTATE_BODY
|
||||||
cmp dword [stream + _end_of_stream], 0
|
cmp word [stream + _end_of_stream], 0
|
||||||
cmovne tmp5, tmp1
|
cmovne tmp5, tmp1
|
||||||
cmp dword [stream + _flush], _NO_FLUSH
|
cmp word [stream + _flush], _NO_FLUSH
|
||||||
cmovne tmp5, tmp1
|
cmovne tmp5, tmp1
|
||||||
mov dword [stream + _internal_state_state], tmp5 %+ d
|
mov dword [stream + _internal_state_state], tmp5 %+ d
|
||||||
|
|
||||||
@ -545,7 +545,7 @@ write_first_byte:
|
|||||||
cmp m_out_buf, [stream + _internal_state_bitbuf_m_out_end]
|
cmp m_out_buf, [stream + _internal_state_bitbuf_m_out_end]
|
||||||
ja output_end
|
ja output_end
|
||||||
|
|
||||||
mov dword [stream + _internal_state_has_hist], IGZIP_HIST
|
mov word [stream + _internal_state_has_hist], IGZIP_HIST
|
||||||
|
|
||||||
mov [stream + _internal_state_head + 2 * hash], f_i %+ w
|
mov [stream + _internal_state_head + 2 * hash], f_i %+ w
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ skip_SLOP:
|
|||||||
|
|
||||||
mov curr_data %+ d, [file_start + f_i]
|
mov curr_data %+ d, [file_start + f_i]
|
||||||
|
|
||||||
cmp dword [stream + _internal_state_has_hist], IGZIP_NO_HIST
|
cmp word [stream + _internal_state_has_hist], IGZIP_NO_HIST
|
||||||
jne skip_write_first_byte
|
jne skip_write_first_byte
|
||||||
|
|
||||||
cmp m_out_buf, [stream + _internal_state_bitbuf_m_out_end]
|
cmp m_out_buf, [stream + _internal_state_bitbuf_m_out_end]
|
||||||
@ -135,7 +135,7 @@ skip_SLOP:
|
|||||||
compute_hash hash, curr_data
|
compute_hash hash, curr_data
|
||||||
and hash %+ d, HASH_MASK
|
and hash %+ d, HASH_MASK
|
||||||
mov [stream + _internal_state_head + 2 * hash], f_i %+ w
|
mov [stream + _internal_state_head + 2 * hash], f_i %+ w
|
||||||
mov dword [stream + _internal_state_has_hist], IGZIP_HIST
|
mov word [stream + _internal_state_has_hist], IGZIP_HIST
|
||||||
jmp encode_literal
|
jmp encode_literal
|
||||||
|
|
||||||
skip_write_first_byte:
|
skip_write_first_byte:
|
||||||
@ -276,8 +276,8 @@ write_eob:
|
|||||||
|
|
||||||
write_bits m_bits, m_bit_count, code2, code_len2, m_out_buf, tmp1
|
write_bits m_bits, m_bit_count, code2, code_len2, m_out_buf, tmp1
|
||||||
|
|
||||||
mov dword [stream + _internal_state_has_eob], 1
|
mov word [stream + _internal_state_has_eob], 1
|
||||||
cmp dword [stream + _end_of_stream], 1
|
cmp word [stream + _end_of_stream], 1
|
||||||
jne sync_flush
|
jne sync_flush
|
||||||
; state->state = ZSTATE_TRL;
|
; state->state = ZSTATE_TRL;
|
||||||
mov dword [stream + _internal_state_state], ZSTATE_TRL
|
mov dword [stream + _internal_state_state], ZSTATE_TRL
|
||||||
|
@ -123,9 +123,9 @@ isal_deflate_icf_body_ %+ ARCH %+ :
|
|||||||
;; Set stream's next state
|
;; Set stream's next state
|
||||||
mov rdx, ZSTATE_FLUSH_READ_BUFFER
|
mov rdx, ZSTATE_FLUSH_READ_BUFFER
|
||||||
mov rax, ZSTATE_CREATE_HDR
|
mov rax, ZSTATE_CREATE_HDR
|
||||||
cmp dword [rcx + _end_of_stream], 0
|
cmp word [rcx + _end_of_stream], 0
|
||||||
cmovne rax, rdx
|
cmovne rax, rdx
|
||||||
cmp dword [rcx + _flush], _NO_FLUSH
|
cmp word [rcx + _flush], _NO_FLUSH
|
||||||
cmovne rax, rdx
|
cmovne rax, rdx
|
||||||
mov dword [rcx + _internal_state_state], eax
|
mov dword [rcx + _internal_state_state], eax
|
||||||
ret
|
ret
|
||||||
@ -150,7 +150,7 @@ skip1:
|
|||||||
mov [rsp + gpr_save_mem_offset + 7*8], r15
|
mov [rsp + gpr_save_mem_offset + 7*8], r15
|
||||||
|
|
||||||
mov stream, rcx
|
mov stream, rcx
|
||||||
mov dword [stream + _internal_state_has_eob], 0
|
mov word [stream + _internal_state_has_eob], 0
|
||||||
|
|
||||||
; state->bitbuf.set_buf(stream->next_out, stream->avail_out);
|
; state->bitbuf.set_buf(stream->next_out, stream->avail_out);
|
||||||
mov tmp1, [stream + _level_buf]
|
mov tmp1, [stream + _level_buf]
|
||||||
@ -193,7 +193,7 @@ MARK __body_compute_hash_ %+ ARCH
|
|||||||
and hash, HASH_MASK
|
and hash, HASH_MASK
|
||||||
and hash2, HASH_MASK
|
and hash2, HASH_MASK
|
||||||
|
|
||||||
cmp dword [stream + _internal_state_has_hist], IGZIP_NO_HIST
|
cmp word [stream + _internal_state_has_hist], IGZIP_NO_HIST
|
||||||
je write_first_byte
|
je write_first_byte
|
||||||
|
|
||||||
jmp loop2
|
jmp loop2
|
||||||
@ -401,9 +401,9 @@ write_lit_bits:
|
|||||||
input_end:
|
input_end:
|
||||||
mov tmp1, ZSTATE_FLUSH_READ_BUFFER
|
mov tmp1, ZSTATE_FLUSH_READ_BUFFER
|
||||||
mov tmp2, ZSTATE_BODY
|
mov tmp2, ZSTATE_BODY
|
||||||
cmp dword [stream + _end_of_stream], 0
|
cmp word [stream + _end_of_stream], 0
|
||||||
cmovne tmp2, tmp1
|
cmovne tmp2, tmp1
|
||||||
cmp dword [stream + _flush], _NO_FLUSH
|
cmp word [stream + _flush], _NO_FLUSH
|
||||||
|
|
||||||
cmovne tmp2, tmp1
|
cmovne tmp2, tmp1
|
||||||
mov dword [stream + _internal_state_state], tmp2 %+ d
|
mov dword [stream + _internal_state_state], tmp2 %+ d
|
||||||
@ -482,7 +482,7 @@ write_first_byte:
|
|||||||
cmp m_out_buf, [rsp + m_out_end]
|
cmp m_out_buf, [rsp + m_out_end]
|
||||||
ja output_end
|
ja output_end
|
||||||
|
|
||||||
mov dword [stream + _internal_state_has_hist], IGZIP_HIST
|
mov word [stream + _internal_state_has_hist], IGZIP_HIST
|
||||||
|
|
||||||
mov [stream + _internal_state_head + 2 * hash], f_i %+ w
|
mov [stream + _internal_state_head + 2 * hash], f_i %+ w
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ isal_deflate_icf_finish_01:
|
|||||||
|
|
||||||
mov curr_data %+ d, [file_start + f_i]
|
mov curr_data %+ d, [file_start + f_i]
|
||||||
|
|
||||||
cmp dword [stream + _internal_state_has_hist], IGZIP_NO_HIST
|
cmp word [stream + _internal_state_has_hist], IGZIP_NO_HIST
|
||||||
jne skip_write_first_byte
|
jne skip_write_first_byte
|
||||||
|
|
||||||
cmp m_out_buf, [rsp + m_out_end]
|
cmp m_out_buf, [rsp + m_out_end]
|
||||||
@ -131,7 +131,7 @@ isal_deflate_icf_finish_01:
|
|||||||
compute_hash hash, curr_data
|
compute_hash hash, curr_data
|
||||||
and hash %+ d, HASH_MASK
|
and hash %+ d, HASH_MASK
|
||||||
mov [stream + _internal_state_head + 2 * hash], f_i %+ w
|
mov [stream + _internal_state_head + 2 * hash], f_i %+ w
|
||||||
mov dword [stream + _internal_state_has_hist], IGZIP_HIST
|
mov word [stream + _internal_state_has_hist], IGZIP_HIST
|
||||||
jmp encode_literal
|
jmp encode_literal
|
||||||
|
|
||||||
skip_write_first_byte:
|
skip_write_first_byte:
|
||||||
@ -263,9 +263,9 @@ final_bytes:
|
|||||||
jl final_bytes
|
jl final_bytes
|
||||||
|
|
||||||
input_end:
|
input_end:
|
||||||
cmp dword [stream + _end_of_stream], 0
|
cmp word [stream + _end_of_stream], 0
|
||||||
jne out_end
|
jne out_end
|
||||||
cmp dword [stream + _flush], _NO_FLUSH
|
cmp word [stream + _flush], _NO_FLUSH
|
||||||
jne out_end
|
jne out_end
|
||||||
jmp end
|
jmp end
|
||||||
|
|
||||||
|
@ -284,25 +284,25 @@ struct BitBuf2 {
|
|||||||
|
|
||||||
/** @brief Holds the internal state information for input and output compression streams*/
|
/** @brief Holds the internal state information for input and output compression streams*/
|
||||||
struct isal_zstate {
|
struct isal_zstate {
|
||||||
uint32_t b_bytes_valid; //!< number of bytes of valid data in buffer
|
|
||||||
uint32_t b_bytes_processed; //!< keeps track of the number of bytes processed in isal_zstate.buffer
|
|
||||||
uint8_t *file_start; //!< pointer to where file would logically start
|
uint8_t *file_start; //!< pointer to where file would logically start
|
||||||
uint32_t crc; //!< Current crc
|
|
||||||
struct BitBuf2 bitbuf; //!< Bit Buffer
|
struct BitBuf2 bitbuf; //!< Bit Buffer
|
||||||
|
uint32_t crc; //!< Current crc
|
||||||
enum isal_zstate_state state; //!< Current state in processing the data stream
|
enum isal_zstate_state state; //!< Current state in processing the data stream
|
||||||
|
uint16_t has_wrap_hdr; //!< keeps track of wrapper header
|
||||||
|
uint16_t has_eob_hdr; //!< keeps track of eob hdr (with BFINAL set)
|
||||||
|
uint16_t has_eob; //!< keeps track of eob on the last deflate block
|
||||||
|
uint16_t has_hist; //!< flag to track if there is match history
|
||||||
|
struct isal_mod_hist hist;
|
||||||
uint32_t count; //!< used for partial header/trailer writes
|
uint32_t count; //!< used for partial header/trailer writes
|
||||||
uint8_t tmp_out_buff[16]; //!< temporary array
|
uint8_t tmp_out_buff[16]; //!< temporary array
|
||||||
uint32_t tmp_out_start; //!< temporary variable
|
uint32_t tmp_out_start; //!< temporary variable
|
||||||
uint32_t tmp_out_end; //!< temporary variable
|
uint32_t tmp_out_end; //!< temporary variable
|
||||||
uint32_t has_wrap_hdr; //!< keeps track of wrapper header
|
uint32_t b_bytes_valid; //!< number of valid bytes in buffer
|
||||||
uint32_t has_eob; //!< keeps track of eob on the last deflate block
|
uint32_t b_bytes_processed; //!< number of bytes processed in buffer
|
||||||
uint32_t has_eob_hdr; //!< keeps track of eob hdr (with BFINAL set)
|
uint8_t buffer[2 * IGZIP_HIST_SIZE + ISAL_LOOK_AHEAD]; //!< Internal buffer
|
||||||
uint32_t has_hist; //!< flag to track if there is match history
|
|
||||||
|
|
||||||
struct isal_mod_hist hist;
|
/* Stream should be setup such that the head is cache aligned*/
|
||||||
|
uint16_t head[IGZIP_HASH_SIZE]; //!< Hash array
|
||||||
DECLARE_ALIGNED(uint8_t buffer[2 * IGZIP_HIST_SIZE + ISAL_LOOK_AHEAD], 32); //!< Internal buffer
|
|
||||||
DECLARE_ALIGNED(uint16_t head[IGZIP_HASH_SIZE], 16); //!< Hash array
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -335,8 +335,8 @@ struct isal_zstream {
|
|||||||
uint32_t level; //!< Compression level to use
|
uint32_t level; //!< Compression level to use
|
||||||
uint32_t level_buf_size; //!< Size of level_buf
|
uint32_t level_buf_size; //!< Size of level_buf
|
||||||
uint8_t * level_buf; //!< User allocated buffer required for different compression levels
|
uint8_t * level_buf; //!< User allocated buffer required for different compression levels
|
||||||
uint32_t end_of_stream; //!< non-zero if this is the last input buffer
|
uint16_t end_of_stream; //!< non-zero if this is the last input buffer
|
||||||
uint32_t flush; //!< Flush type can be NO_FLUSH, SYNC_FLUSH or FULL_FLUSH
|
uint16_t flush; //!< Flush type can be NO_FLUSH, SYNC_FLUSH or FULL_FLUSH
|
||||||
uint32_t gzip_flag; //!< Indicate if gzip compression is to be performed
|
uint32_t gzip_flag; //!< Indicate if gzip compression is to be performed
|
||||||
|
|
||||||
struct isal_zstate internal_state; //!< Internal state for this stream
|
struct isal_zstate internal_state; //!< Internal state for this stream
|
||||||
|
Loading…
Reference in New Issue
Block a user