From d389b8d6f856d203b53f1b82feefe63b7a4f57a3 Mon Sep 17 00:00:00 2001 From: Roy Oursler Date: Wed, 6 Jun 2018 12:54:47 -0700 Subject: [PATCH] igzip: Move COMPARE_TYPES usage Change-Id: I87d88618b6f86c1f9618ba9cea132153a8ef2fa5 Signed-off-by: Roy Oursler --- igzip/igzip_body.asm | 26 ++++++-------------------- igzip/igzip_compare_types.asm | 25 ++++++++++++++++++++++++- igzip/igzip_icf_body_h1_gr_bt.asm | 26 ++++++-------------------- igzip/igzip_update_histogram.asm | 25 +++++-------------------- 4 files changed, 41 insertions(+), 61 deletions(-) diff --git a/igzip/igzip_body.asm b/igzip/igzip_body.asm index e4cd601..60942a5 100644 --- a/igzip/igzip_body.asm +++ b/igzip/igzip_body.asm @@ -508,31 +508,17 @@ isal_deflate_body_ %+ ARCH %+ : PINSRD xhash, tmp2 %+ d, 1 PAND xhash, xhash, xmask lea tmp2, [tmp1 + dist - 1] -%if (COMPARE_TYPE == 1) - compare250 tmp1, tmp2, len, tmp3 -%elif (COMPARE_TYPE == 2) - compare250_x tmp1, tmp2, len, tmp3, xtmp0, xtmp1 -%elif (COMPARE_TYPE == 3) - compare250_y tmp1, tmp2, len, tmp3, ytmp0, ytmp1 -%else - %error Unknown Compare type COMPARE_TYPE - % error -%endif + + compare250 tmp1, tmp2, len, tmp3, ytmp0, ytmp1 + jmp .len_dist_huffman .compare_loop2: lea tmp2, [tmp1 + dist2] add tmp1, 1 -%if (COMPARE_TYPE == 1) - compare250 tmp1, tmp2, len2, tmp3 -%elif (COMPARE_TYPE == 2) - compare250_x tmp1, tmp2, len2, tmp3, xtmp0, xtmp1 -%elif (COMPARE_TYPE == 3) - compare250_y tmp1, tmp2, len2, tmp3, ytmp0, ytmp1 -%else -%error Unknown Compare type COMPARE_TYPE - % error -%endif + + compare250 tmp1, tmp2, len2, tmp3, ytmp0, ytmp1 + and curr_data, 0xff get_lit_code curr_data, code3, code_len3, hufftables jmp .len_dist_lit_huffman diff --git a/igzip/igzip_compare_types.asm b/igzip/igzip_compare_types.asm index a5fb6cd..3800189 100644 --- a/igzip/igzip_compare_types.asm +++ b/igzip/igzip_compare_types.asm @@ -83,7 +83,7 @@ ;; compare 258 bytes = 8 * 32 + 2 ;; tmp16 is a 16-bit version of tmp ;; compare258 src1, src2, result, tmp -%macro compare250 4 +%macro compare250_r 4 %define %%src1 %1 %define %%src2 %2 %define %%result %3 @@ -372,6 +372,29 @@ %%end: %endm +%macro compare250 6 +%define %%src1 %1 +%define %%src2 %2 +%define %%result %3 +%define %%tmp %4 +%define %%xtmp0 %5x +%define %%xtmp1 %6x +%define %%ytmp0 %5 +%define %%ytmp1 %6 + +%if (COMPARE_TYPE == 1) + compare250_r %%src1, %%src2, %%result, %%tmp +%elif (COMPARE_TYPE == 2) + compare250_x %%src1, %%src2, %%result, %%tmp, %%xtmp0, %%xtmp1 +%elif (COMPARE_TYPE == 3) + compare250_y %%src1, %%src2, %%result, %%tmp, %%ytmp0, %%ytmp1 +%else +%error Unknown Compare type COMPARE_TYPE + % error +%endif +%endmacro + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/igzip/igzip_icf_body_h1_gr_bt.asm b/igzip/igzip_icf_body_h1_gr_bt.asm index 903e1b3..9f5a67b 100644 --- a/igzip/igzip_icf_body_h1_gr_bt.asm +++ b/igzip/igzip_icf_body_h1_gr_bt.asm @@ -470,31 +470,17 @@ isal_deflate_icf_body_ %+ METHOD %+ _ %+ ARCH %+ : .compare_loop: lea tmp2, [tmp1 + dist - 1] -%if (COMPARE_TYPE == 1) - compare250 tmp1, tmp2, len, tmp3 -%elif (COMPARE_TYPE == 2) - compare250_x tmp1, tmp2, len, tmp3, xtmp0, xtmp1 -%elif (COMPARE_TYPE == 3) - compare250_y tmp1, tmp2, len, tmp3, ytmp0, ytmp1 -%else - %error Unknown Compare type COMPARE_TYPE - % error -%endif + + compare250 tmp1, tmp2, len, tmp3, ytmp0, ytmp1 + jmp .len_dist_huffman .compare_loop2: lea tmp2, [tmp1 + dist2] add tmp1, 1 -%if (COMPARE_TYPE == 1) - compare250 tmp1, tmp2, len2, tmp3 -%elif (COMPARE_TYPE == 2) - compare250_x tmp1, tmp2, len2, tmp3, xtmp0, xtmp1 -%elif (COMPARE_TYPE == 3) - compare250_y tmp1, tmp2, len2, tmp3, ytmp0, ytmp1 -%else -%error Unknown Compare type COMPARE_TYPE - % error -%endif + + compare250 tmp1, tmp2, len2, tmp3, ytmp0, ytmp1 + movzx lit_code, curr_data %+ b shr curr_data, 8 inc dword [lit_len_hist + HIST_ELEM_SIZE*lit_code] diff --git a/igzip/igzip_update_histogram.asm b/igzip/igzip_update_histogram.asm index 0b71be0..3dfbf89 100644 --- a/igzip/igzip_update_histogram.asm +++ b/igzip/igzip_update_histogram.asm @@ -516,16 +516,9 @@ compare_loop: and hash %+ d, LVL0_HASH_MASK and hash2 %+ d, LVL0_HASH_MASK lea tmp2, [tmp1 + dist - 1] -%if (COMPARE_TYPE == 1) - compare250 tmp1, tmp2, len, tmp3 -%elif (COMPARE_TYPE == 2) - compare250_x tmp1, tmp2, len, tmp3, xtmp0, xtmp1 -%elif (COMPARE_TYPE == 3) - compare250_y tmp1, tmp2, len, tmp3, ytmp0, ytmp1 -%else - %error Unknown Compare type COMPARE_TYPE - % error -%endif + + compare250 tmp1, tmp2, len, tmp3, ytmp0, ytmp1 + lea tmp3, [f_i + 1] jmp len_dist_huffman @@ -533,16 +526,8 @@ compare_loop2: add tmp1, 1 lea tmp2, [tmp1 + dist2 - 1] -%if (COMPARE_TYPE == 1) - compare250 tmp1, tmp2, len2, tmp3 -%elif (COMPARE_TYPE == 2) - compare250_x tmp1, tmp2, len2, tmp3, xtmp0, xtmp1 -%elif (COMPARE_TYPE == 3) - compare250_y tmp1, tmp2, len2, tmp3, ytmp0, ytmp1 -%else -%error Unknown Compare type COMPARE_TYPE - % error -%endif + compare250 tmp1, tmp2, len2, tmp3, ytmp0, ytmp1 + and curr_data, 0xff inc qword [histogram + _lit_len_offset + 8 * curr_data] lea tmp3, [f_i + 1]