]> granicus.if.org Git - libjpeg-turbo/commitdiff
x86-64 SIMD: Optimize argument collection
authorDRC <information@libjpeg-turbo.org>
Sun, 29 May 2016 15:51:16 +0000 (10:51 -0500)
committerDRC <information@libjpeg-turbo.org>
Wed, 1 Jun 2016 03:54:37 +0000 (22:54 -0500)
Expand collect_args/uncollect_args macros so that the number of
arguments can be specified.  This prevents unnecessary push and mov
instructions.

NOTE: On Windows, the push/pop of xmm6 and xmm7 had to be moved to the
other end of the macro to ensure that rsp is aligned on a 16-byte
boundary.

17 files changed:
simd/jccolext-sse2-64.asm
simd/jcgryext-sse2-64.asm
simd/jchuff-sse2-64.asm
simd/jcsample-sse2-64.asm
simd/jdcolext-sse2-64.asm
simd/jdmrgext-sse2-64.asm
simd/jdsample-sse2-64.asm
simd/jfdctflt-sse-64.asm
simd/jfdctfst-sse2-64.asm
simd/jfdctint-sse2-64.asm
simd/jidctflt-sse2-64.asm
simd/jidctfst-sse2-64.asm
simd/jidctint-sse2-64.asm
simd/jidctred-sse2-64.asm
simd/jquantf-sse2-64.asm
simd/jquanti-sse2-64.asm
simd/jsimdext.inc

index bf60459b7e24ed31587f420d3efb1cf9fb9550ca..258dfad23c159ca983c339df86de404b0eb9e639 100644 (file)
 ;                             JDIMENSION output_row, int num_rows);
 ;
 
-; r10 = JDIMENSION img_width
+; r10d = JDIMENSION img_width
 ; r11 = JSAMPARRAY input_buf
 ; r12 = JSAMPIMAGE output_buf
-; r13 = JDIMENSION output_row
-; r14 = int num_rows
+; r13d = JDIMENSION output_row
+; r14d = int num_rows
 
 %define wk(i)   rbp-(WK_NUM-(i))*SIZEOF_XMMWORD  ; xmmword wk[WK_NUM]
 %define WK_NUM  8
@@ -48,7 +48,7 @@ EXTN(jsimd_rgb_ycc_convert_sse2):
     mov         [rsp], rax
     mov         rbp, rsp                     ; rbp = aligned rbp
     lea         rsp, [wk(0)]
-    collect_args
+    collect_args 5
     push        rbx
 
     mov         ecx, r10d
@@ -475,7 +475,7 @@ EXTN(jsimd_rgb_ycc_convert_sse2):
 
 .return:
     pop         rbx
-    uncollect_args
+    uncollect_args 5
     mov         rsp, rbp                ; rsp <- aligned rbp
     pop         rsp                     ; rsp <- original rbp
     pop         rbp
index 504e295be29be10395aa306c953b8b2ea96f06ea..663104e3d2e6448100fb0f1de99f53a9b2d95afd 100644 (file)
 ;                              JDIMENSION output_row, int num_rows);
 ;
 
-; r10 = JDIMENSION img_width
+; r10d = JDIMENSION img_width
 ; r11 = JSAMPARRAY input_buf
 ; r12 = JSAMPIMAGE output_buf
-; r13 = JDIMENSION output_row
-; r14 = int num_rows
+; r13d = JDIMENSION output_row
+; r14d = int num_rows
 
 %define wk(i)   rbp-(WK_NUM-(i))*SIZEOF_XMMWORD  ; xmmword wk[WK_NUM]
 %define WK_NUM  2
@@ -48,7 +48,7 @@ EXTN(jsimd_rgb_gray_convert_sse2):
     mov         [rsp], rax
     mov         rbp, rsp                     ; rbp = aligned rbp
     lea         rsp, [wk(0)]
-    collect_args
+    collect_args 5
     push        rbx
 
     mov         ecx, r10d
@@ -354,7 +354,7 @@ EXTN(jsimd_rgb_gray_convert_sse2):
 
 .return:
     pop         rbx
-    uncollect_args
+    uncollect_args 5
     mov         rsp, rbp                ; rsp <- aligned rbp
     pop         rsp                     ; rsp <- original rbp
     pop         rbp
index 701cbc2ffc3bce0b7595aeb43e27a67787ab4079..486fd8040c7e67844fa3a88b7195caa8e1976116 100644 (file)
@@ -172,7 +172,7 @@ EXTN(jconst_huff_encode_one_block):
 ; r10 = working_state *state
 ; r11 = JOCTET *buffer
 ; r12 = JCOEFPTR block
-; r13 = int last_dc_val
+; r13d = int last_dc_val
 ; r14 = c_derived_tbl *dctbl
 ; r15 = c_derived_tbl *actbl
 
@@ -193,7 +193,7 @@ EXTN(jsimd_huff_encode_one_block_sse2):
     mov         [rsp], rax
     mov         rbp,rsp                      ; rbp = aligned rbp
     lea         rsp, [t2]
-    collect_args
+    collect_args 6
 %ifdef WIN64
     movaps      XMMWORD [rsp-1*SIZEOF_XMMWORD], xmm8
     movaps      XMMWORD [rsp-2*SIZEOF_XMMWORD], xmm9
@@ -349,7 +349,7 @@ EXTN(jsimd_huff_encode_one_block_sse2):
     movaps      xmm8, XMMWORD [rsp+3*SIZEOF_XMMWORD]
     add         rsp, 4*SIZEOF_XMMWORD
 %endif
-    uncollect_args
+    uncollect_args 6
     mov         rsp, rbp                ; rsp <- aligned rbp
     pop         rsp                     ; rsp <- original rbp
     pop         rbp
index f6b2aa7b421d291f83b56034c6440b682df0abbd..29fc9822cadfb71ae8eef03600573b7e1b551db1 100644 (file)
 ;                             JSAMPARRAY input_data, JSAMPARRAY output_data);
 ;
 
-; r10 = JDIMENSION image_width
+; r10d = JDIMENSION image_width
 ; r11 = int max_v_samp_factor
-; r12 = JDIMENSION v_samp_factor
-; r13 = JDIMENSION width_blocks
+; r12d = JDIMENSION v_samp_factor
+; r13d = JDIMENSION width_blocks
 ; r14 = JSAMPARRAY input_data
 ; r15 = JSAMPARRAY output_data
 
@@ -46,7 +46,7 @@ EXTN(jsimd_h2v1_downsample_sse2):
     push        rbp
     mov         rax, rsp
     mov         rbp, rsp
-    collect_args
+    collect_args 6
 
     mov         ecx, r13d
     shl         rcx, 3                  ; imul rcx,DCTSIZE (rcx = output_cols)
@@ -160,7 +160,7 @@ EXTN(jsimd_h2v1_downsample_sse2):
     jg          near .rowloop
 
 .return:
-    uncollect_args
+    uncollect_args 6
     pop         rbp
     ret
 
@@ -176,10 +176,10 @@ EXTN(jsimd_h2v1_downsample_sse2):
 ;                             JSAMPARRAY input_data, JSAMPARRAY output_data);
 ;
 
-; r10 = JDIMENSION image_width
+; r10d = JDIMENSION image_width
 ; r11 = int max_v_samp_factor
-; r12 = JDIMENSION v_samp_factor
-; r13 = JDIMENSION width_blocks
+; r12d = JDIMENSION v_samp_factor
+; r13d = JDIMENSION width_blocks
 ; r14 = JSAMPARRAY input_data
 ; r15 = JSAMPARRAY output_data
 
@@ -190,7 +190,7 @@ EXTN(jsimd_h2v2_downsample_sse2):
     push        rbp
     mov         rax, rsp
     mov         rbp, rsp
-    collect_args
+    collect_args 6
 
     mov         ecx, r13d
     shl         rcx, 3                  ; imul rcx,DCTSIZE (rcx = output_cols)
@@ -320,7 +320,7 @@ EXTN(jsimd_h2v2_downsample_sse2):
     jg          near .rowloop
 
 .return:
-    uncollect_args
+    uncollect_args 6
     pop         rbp
     ret
 
index a42091ee400359dfa98254a6f4166b39c79a0d40..b48b2b7bb95365bae2602465b1d198d5bf40f27b 100644 (file)
 ;                             JSAMPARRAY output_buf, int num_rows)
 ;
 
-; r10 = JDIMENSION out_width
+; r10d = JDIMENSION out_width
 ; r11 = JSAMPIMAGE input_buf
-; r12 = JDIMENSION input_row
+; r12d = JDIMENSION input_row
 ; r13 = JSAMPARRAY output_buf
-; r14 = int num_rows
+; r14d = int num_rows
 
 %define wk(i)   rbp-(WK_NUM-(i))*SIZEOF_XMMWORD  ; xmmword wk[WK_NUM]
 %define WK_NUM  2
@@ -48,7 +48,7 @@ EXTN(jsimd_ycc_rgb_convert_sse2):
     mov         [rsp], rax
     mov         rbp, rsp                     ; rbp = aligned rbp
     lea         rsp, [wk(0)]
-    collect_args
+    collect_args 5
     push        rbx
 
     mov         ecx, r10d               ; num_cols
@@ -429,7 +429,7 @@ EXTN(jsimd_ycc_rgb_convert_sse2):
 
 .return:
     pop         rbx
-    uncollect_args
+    uncollect_args 5
     mov         rsp, rbp                ; rsp <- aligned rbp
     pop         rsp                     ; rsp <- original rbp
     pop         rbp
index 9e8eb2743015ef34faf67aea954f7977d3c1c3ff..93a3ef34c2c55b3d11cbb0dd991ced7d4909b126 100644 (file)
@@ -29,9 +29,9 @@
 ;                                  JSAMPARRAY output_buf);
 ;
 
-; r10 = JDIMENSION output_width
+; r10d = JDIMENSION output_width
 ; r11 = JSAMPIMAGE input_buf
-; r12 = JDIMENSION in_row_group_ctr
+; r12d = JDIMENSION in_row_group_ctr
 ; r13 = JSAMPARRAY output_buf
 
 %define wk(i)   rbp-(WK_NUM-(i))*SIZEOF_XMMWORD  ; xmmword wk[WK_NUM]
@@ -48,7 +48,7 @@ EXTN(jsimd_h2v1_merged_upsample_sse2):
     mov         [rsp], rax
     mov         rbp, rsp                     ; rbp = aligned rbp
     lea         rsp, [wk(0)]
-    collect_args
+    collect_args 4
     push        rbx
 
     mov         ecx, r10d               ; col
@@ -422,7 +422,7 @@ EXTN(jsimd_h2v1_merged_upsample_sse2):
 
 .return:
     pop         rbx
-    uncollect_args
+    uncollect_args 4
     mov         rsp, rbp                ; rsp <- aligned rbp
     pop         rsp                     ; rsp <- original rbp
     pop         rbp
@@ -439,9 +439,9 @@ EXTN(jsimd_h2v1_merged_upsample_sse2):
 ;                                  JSAMPARRAY output_buf);
 ;
 
-; r10 = JDIMENSION output_width
+; r10d = JDIMENSION output_width
 ; r11 = JSAMPIMAGE input_buf
-; r12 = JDIMENSION in_row_group_ctr
+; r12d = JDIMENSION in_row_group_ctr
 ; r13 = JSAMPARRAY output_buf
 
     align       16
@@ -451,7 +451,7 @@ EXTN(jsimd_h2v2_merged_upsample_sse2):
     push        rbp
     mov         rax, rsp
     mov         rbp, rsp
-    collect_args
+    collect_args 4
     push        rbx
 
     mov         eax, r10d
@@ -528,7 +528,7 @@ EXTN(jsimd_h2v2_merged_upsample_sse2):
     pop         rdx
 
     pop         rbx
-    uncollect_args
+    uncollect_args 4
     pop         rbp
     ret
 
index 9a99050b90d0bfec7a33564bc91e19f4a00ff1b8..11c3464f9eb2255c244e5d2dacf02abde94c9fdd 100644 (file)
@@ -53,7 +53,7 @@ PW_EIGHT times 8 dw 8
 ;
 
 ; r10 = int max_v_samp_factor
-; r11 = JDIMENSION downsampled_width
+; r11d = JDIMENSION downsampled_width
 ; r12 = JSAMPARRAY input_data
 ; r13 = JSAMPARRAY *output_data_ptr
 
@@ -64,7 +64,7 @@ EXTN(jsimd_h2v1_fancy_upsample_sse2):
     push        rbp
     mov         rax, rsp
     mov         rbp, rsp
-    collect_args
+    collect_args 4
 
     mov         eax, r11d               ; colctr
     test        rax, rax
@@ -175,7 +175,7 @@ EXTN(jsimd_h2v1_fancy_upsample_sse2):
     jg          near .rowloop
 
 .return:
-    uncollect_args
+    uncollect_args 4
     pop         rbp
     ret
 
@@ -192,7 +192,7 @@ EXTN(jsimd_h2v1_fancy_upsample_sse2):
 ;
 
 ; r10 = int max_v_samp_factor
-; r11 = JDIMENSION downsampled_width
+; r11d = JDIMENSION downsampled_width
 ; r12 = JSAMPARRAY input_data
 ; r13 = JSAMPARRAY *output_data_ptr
 
@@ -210,7 +210,7 @@ EXTN(jsimd_h2v2_fancy_upsample_sse2):
     mov         [rsp], rax
     mov         rbp, rsp                     ; rbp = aligned rbp
     lea         rsp, [wk(0)]
-    collect_args
+    collect_args 4
     push        rbx
 
     mov         eax, r11d               ; colctr
@@ -473,7 +473,7 @@ EXTN(jsimd_h2v2_fancy_upsample_sse2):
 
 .return:
     pop         rbx
-    uncollect_args
+    uncollect_args 4
     mov         rsp, rbp                ; rsp <- aligned rbp
     pop         rsp                     ; rsp <- original rbp
     pop         rbp
@@ -492,7 +492,7 @@ EXTN(jsimd_h2v2_fancy_upsample_sse2):
 ;
 
 ; r10 = int max_v_samp_factor
-; r11 = JDIMENSION output_width
+; r11d = JDIMENSION output_width
 ; r12 = JSAMPARRAY input_data
 ; r13 = JSAMPARRAY *output_data_ptr
 
@@ -503,7 +503,7 @@ EXTN(jsimd_h2v1_upsample_sse2):
     push        rbp
     mov         rax, rsp
     mov         rbp, rsp
-    collect_args
+    collect_args 4
 
     mov         edx, r11d
     add         rdx, byte (2*SIZEOF_XMMWORD)-1
@@ -564,7 +564,7 @@ EXTN(jsimd_h2v1_upsample_sse2):
     jg          short .rowloop
 
 .return:
-    uncollect_args
+    uncollect_args 4
     pop         rbp
     ret
 
@@ -581,7 +581,7 @@ EXTN(jsimd_h2v1_upsample_sse2):
 ;
 
 ; r10 = int max_v_samp_factor
-; r11 = JDIMENSION output_width
+; r11d = JDIMENSION output_width
 ; r12 = JSAMPARRAY input_data
 ; r13 = JSAMPARRAY *output_data_ptr
 
@@ -592,7 +592,7 @@ EXTN(jsimd_h2v2_upsample_sse2):
     push        rbp
     mov         rax, rsp
     mov         rbp, rsp
-    collect_args
+    collect_args 4
     push        rbx
 
     mov         edx, r11d
@@ -661,7 +661,7 @@ EXTN(jsimd_h2v2_upsample_sse2):
 
 .return:
     pop         rbx
-    uncollect_args
+    uncollect_args 4
     pop         rbp
     ret
 
index d52568d964422dd99822ebece464ac73747496d7..cd481345946a6584232cb82e23e173820e7b4689 100644 (file)
@@ -74,7 +74,7 @@ EXTN(jsimd_fdct_float_sse):
     mov         [rsp], rax
     mov         rbp, rsp                     ; rbp = aligned rbp
     lea         rsp, [wk(0)]
-    collect_args
+    collect_args 1
 
     ; ---- Pass 1: process rows.
 
@@ -346,7 +346,7 @@ EXTN(jsimd_fdct_float_sse):
     dec         rcx
     jnz         near .columnloop
 
-    uncollect_args
+    uncollect_args 1
     mov         rsp, rbp                ; rsp <- aligned rbp
     pop         rsp                     ; rsp <- original rbp
     pop         rbp
index 19aa30434efdc2dbc828f9f8197b11364c11ec97..5fbc4d743faa902d8b74a1d05f3cf3d58068a2ea 100644 (file)
@@ -89,7 +89,7 @@ EXTN(jsimd_fdct_ifast_sse2):
     mov         [rsp], rax
     mov         rbp, rsp                     ; rbp = aligned rbp
     lea         rsp, [wk(0)]
-    collect_args
+    collect_args 1
 
     ; ---- Pass 1: process rows.
 
@@ -380,7 +380,7 @@ EXTN(jsimd_fdct_ifast_sse2):
     movdqa      XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)], xmm6
     movdqa      XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_DCTELEM)], xmm2
 
-    uncollect_args
+    uncollect_args 1
     mov         rsp, rbp                ; rsp <- aligned rbp
     pop         rsp                     ; rsp <- original rbp
     pop         rbp
index 0f82cdf399b25525f6635e9a4df9d69f7fc13ecb..70148f18c28f6555bd5d9f8795b990c19ed32a8a 100644 (file)
@@ -110,7 +110,7 @@ EXTN(jsimd_fdct_islow_sse2):
     mov         [rsp], rax
     mov         rbp, rsp                     ; rbp = aligned rbp
     lea         rsp, [wk(0)]
-    collect_args
+    collect_args 1
 
     ; ---- Pass 1: process rows.
 
@@ -610,7 +610,7 @@ EXTN(jsimd_fdct_islow_sse2):
     movdqa      XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_DCTELEM)], xmm1
     movdqa      XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_DCTELEM)], xmm3
 
-    uncollect_args
+    uncollect_args 1
     mov         rsp, rbp                ; rsp <- aligned rbp
     pop         rsp                     ; rsp <- original rbp
     pop         rbp
index 9d78fa19675c1bcad3eb21d9aec3a700901ca452..7e714d92c824f843d2b4cbf3de26054906bf423e 100644 (file)
@@ -64,7 +64,7 @@ PB_CENTERJSAMP  times 16 db  CENTERJSAMPLE
 ; r10 = void *dct_table
 ; r11 = JCOEFPTR coef_block
 ; r12 = JSAMPARRAY output_buf
-; r13 = JDIMENSION output_col
+; r13d = JDIMENSION output_col
 
 %define original_rbp  rbp+0
 %define wk(i)         rbp-(WK_NUM-(i))*SIZEOF_XMMWORD  ; xmmword wk[WK_NUM]
@@ -83,7 +83,7 @@ EXTN(jsimd_idct_float_sse2):
     mov         [rsp], rax
     mov         rbp, rsp                     ; rbp = aligned rbp
     lea         rsp, [workspace]
-    collect_args
+    collect_args 4
     push        rbx
 
     ; ---- Pass 1: process columns from input, store into work array.
@@ -471,7 +471,7 @@ EXTN(jsimd_idct_float_sse2):
     jnz         near .rowloop
 
     pop         rbx
-    uncollect_args
+    uncollect_args 4
     mov         rsp, rbp                ; rsp <- aligned rbp
     pop         rsp                     ; rsp <- original rbp
     pop         rbp
index 93dd6aaf96dbf03fd9b4512971738a9b792a2b40..e7a1617080823f0c0ba7b84a14674b3931863ced 100644 (file)
@@ -85,7 +85,7 @@ PB_CENTERJSAMP times 16 db  CENTERJSAMPLE
 ; r10 = jpeg_component_info *compptr
 ; r11 = JCOEFPTR coef_block
 ; r12 = JSAMPARRAY output_buf
-; r13 = JDIMENSION output_col
+; r13d = JDIMENSION output_col
 
 %define original_rbp  rbp+0
 %define wk(i)         rbp-(WK_NUM-(i))*SIZEOF_XMMWORD  ; xmmword wk[WK_NUM]
@@ -102,7 +102,7 @@ EXTN(jsimd_idct_ifast_sse2):
     mov         [rsp], rax
     mov         rbp, rsp                     ; rbp = aligned rbp
     lea         rsp, [wk(0)]
-    collect_args
+    collect_args 4
 
     ; ---- Pass 1: process columns from input.
 
@@ -479,7 +479,7 @@ EXTN(jsimd_idct_ifast_sse2):
     movq        XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm6
     movq        XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm2
 
-    uncollect_args
+    uncollect_args 4
     mov         rsp, rbp                ; rsp <- aligned rbp
     pop         rsp                     ; rsp <- original rbp
     pop         rbp
index 6331181436461887e5f90a502b2f0319dab42657..a8cbce8f6c235131c550521409ae2e4c5db64269 100644 (file)
@@ -98,7 +98,7 @@ PB_CENTERJSAMP times 16 db  CENTERJSAMPLE
 ; r10 = jpeg_component_info *compptr
 ; r11 = JCOEFPTR coef_block
 ; r12 = JSAMPARRAY output_buf
-; r13 = JDIMENSION output_col
+; r13d = JDIMENSION output_col
 
 %define original_rbp  rbp+0
 %define wk(i)         rbp-(WK_NUM-(i))*SIZEOF_XMMWORD  ; xmmword wk[WK_NUM]
@@ -115,7 +115,7 @@ EXTN(jsimd_idct_islow_sse2):
     mov         [rsp], rax
     mov         rbp, rsp                     ; rbp = aligned rbp
     lea         rsp, [wk(0)]
-    collect_args
+    collect_args 4
 
     ; ---- Pass 1: process columns from input.
 
@@ -836,7 +836,7 @@ EXTN(jsimd_idct_islow_sse2):
     movq        XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm2
     movq        XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm5
 
-    uncollect_args
+    uncollect_args 4
     mov         rsp, rbp                ; rsp <- aligned rbp
     pop         rsp                     ; rsp <- original rbp
     pop         rbp
index 31a3f36a46a7f85aba70182d1e39d4e9116c577e..dace694dbeb581f39b7fa626f0c685ed765ebea1 100644 (file)
@@ -106,7 +106,7 @@ PB_CENTERJSAMP  times 16 db  CENTERJSAMPLE
 ; r10 = void *dct_table
 ; r11 = JCOEFPTR coef_block
 ; r12 = JSAMPARRAY output_buf
-; r13 = JDIMENSION output_col
+; r13d = JDIMENSION output_col
 
 %define original_rbp  rbp+0
 %define wk(i)         rbp-(WK_NUM-(i))*SIZEOF_XMMWORD  ; xmmword wk[WK_NUM]
@@ -123,7 +123,7 @@ EXTN(jsimd_idct_4x4_sse2):
     mov         [rsp], rax
     mov         rbp, rsp                     ; rbp = aligned rbp
     lea         rsp, [wk(0)]
-    collect_args
+    collect_args 4
 
     ; ---- Pass 1: process columns from input.
 
@@ -389,7 +389,7 @@ EXTN(jsimd_idct_4x4_sse2):
     movd        XMM_DWORD [rdx+rax*SIZEOF_JSAMPLE], xmm1
     movd        XMM_DWORD [rsi+rax*SIZEOF_JSAMPLE], xmm3
 
-    uncollect_args
+    uncollect_args 4
     mov         rsp, rbp                ; rsp <- aligned rbp
     pop         rsp                     ; rsp <- original rbp
     pop         rbp
@@ -409,7 +409,7 @@ EXTN(jsimd_idct_4x4_sse2):
 ; r10 = void *dct_table
 ; r11 = JCOEFPTR coef_block
 ; r12 = JSAMPARRAY output_buf
-; r13 = JDIMENSION output_col
+; r13d = JDIMENSION output_col
 
     align       16
     global      EXTN(jsimd_idct_2x2_sse2)
@@ -418,7 +418,7 @@ EXTN(jsimd_idct_2x2_sse2):
     push        rbp
     mov         rax, rsp
     mov         rbp, rsp
-    collect_args
+    collect_args 4
     push        rbx
 
     ; ---- Pass 1: process columns from input.
@@ -566,7 +566,7 @@ EXTN(jsimd_idct_2x2_sse2):
     mov         WORD [rsi+rax*SIZEOF_JSAMPLE], cx
 
     pop         rbx
-    uncollect_args
+    uncollect_args 4
     pop         rbp
     ret
 
index ed69bc217a14ac2bc5e1e24b92452c350995953f..241b85724c1ad0e9a51cd8a758894172723cf6b4 100644 (file)
@@ -31,7 +31,7 @@
 ;
 
 ; r10 = JSAMPARRAY sample_data
-; r11 = JDIMENSION start_col
+; r11d = JDIMENSION start_col
 ; r12 = FAST_FLOAT *workspace
 
     align       16
@@ -41,7 +41,7 @@ EXTN(jsimd_convsamp_float_sse2):
     push        rbp
     mov         rax, rsp
     mov         rbp, rsp
-    collect_args
+    collect_args 3
     push        rbx
 
     pcmpeqw     xmm7, xmm7
@@ -90,7 +90,7 @@ EXTN(jsimd_convsamp_float_sse2):
     jnz         short .convloop
 
     pop         rbx
-    uncollect_args
+    uncollect_args 3
     pop         rbp
     ret
 
@@ -115,7 +115,7 @@ EXTN(jsimd_quantize_float_sse2):
     push        rbp
     mov         rax, rsp
     mov         rbp, rsp
-    collect_args
+    collect_args 3
 
     mov         rsi, r12
     mov         rdx, r11
@@ -148,7 +148,7 @@ EXTN(jsimd_quantize_float_sse2):
     dec         rax
     jnz         short .quantloop
 
-    uncollect_args
+    uncollect_args 3
     pop         rbp
     ret
 
index 7cb68725f79297f52a510134143055bc3eac8ad7..0f8f9eced98fe4bf2c3b67a5c54545c2b5a829f7 100644 (file)
@@ -31,7 +31,7 @@
 ;
 
 ; r10 = JSAMPARRAY sample_data
-; r11 = JDIMENSION start_col
+; r11d = JDIMENSION start_col
 ; r12 = DCTELEM *workspace
 
     align       16
@@ -41,7 +41,7 @@ EXTN(jsimd_convsamp_sse2):
     push        rbp
     mov         rax, rsp
     mov         rbp, rsp
-    collect_args
+    collect_args 3
     push        rbx
 
     pxor        xmm6, xmm6              ; xmm6=(all 0's)
@@ -85,7 +85,7 @@ EXTN(jsimd_convsamp_sse2):
     jnz         short .convloop
 
     pop         rbx
-    uncollect_args
+    uncollect_args 3
     pop         rbp
     ret
 
@@ -117,7 +117,7 @@ EXTN(jsimd_quantize_sse2):
     push        rbp
     mov         rax, rsp
     mov         rbp, rsp
-    collect_args
+    collect_args 3
 
     mov         rsi, r12
     mov         rdx, r11
@@ -177,7 +177,7 @@ EXTN(jsimd_quantize_sse2):
     dec         rax
     jnz         near .quantloop
 
-    uncollect_args
+    uncollect_args 3
     pop         rbp
     ret
 
index 7c0b8099e3b4b543166679b2d4ea47a67b567fdb..c138f01b119cc51bd3405a56fe219e3ebd53b500 100644 (file)
@@ -307,61 +307,99 @@ const_base:
 
 %ifdef WIN64
 
-%imacro collect_args 0
-    push        r12
-    push        r13
-    push        r14
-    push        r15
+%imacro collect_args 1
+    sub         rsp, SIZEOF_XMMWORD
+    movaps      XMMWORD [rsp], xmm6
+    sub         rsp, SIZEOF_XMMWORD
+    movaps      XMMWORD [rsp], xmm7
     mov         r10, rcx
+%if %1 > 1
     mov         r11, rdx
+%endif
+%if %1 > 2
+    push        r12
     mov         r12, r8
+%endif
+%if %1 > 3
+    push        r13
     mov         r13, r9
+%endif
+%if %1 > 4
+    push        r14
     mov         r14, [rax+48]
+%endif
+%if %1 > 5
+    push        r15
     mov         r15, [rax+56]
+%endif
     push        rsi
     push        rdi
-    sub         rsp, SIZEOF_XMMWORD
-    movaps      XMMWORD [rsp], xmm6
-    sub         rsp, SIZEOF_XMMWORD
-    movaps      XMMWORD [rsp], xmm7
 %endmacro
 
-%imacro uncollect_args 0
-    movaps      xmm7, XMMWORD [rsp]
-    add         rsp, SIZEOF_XMMWORD
-    movaps      xmm6, XMMWORD [rsp]
-    add         rsp, SIZEOF_XMMWORD
+%imacro uncollect_args 1
     pop         rdi
     pop         rsi
+%if %1 > 5
     pop         r15
+%endif
+%if %1 > 4
     pop         r14
+%endif
+%if %1 > 3
     pop         r13
+%endif
+%if %1 > 2
     pop         r12
+%endif
+    movaps      xmm7, XMMWORD [rsp]
+    add         rsp, SIZEOF_XMMWORD
+    movaps      xmm6, XMMWORD [rsp]
+    add         rsp, SIZEOF_XMMWORD
 %endmacro
 
 %else
 
-%imacro collect_args 0
+%imacro collect_args 1
     push        r10
-    push        r11
-    push        r12
-    push        r13
-    push        r14
-    push        r15
     mov         r10, rdi
+%if %1 > 1
+    push        r11
     mov         r11, rsi
+%endif
+%if %1 > 2
+    push        r12
     mov         r12, rdx
+%endif
+%if %1 > 3
+    push        r13
     mov         r13, rcx
+%endif
+%if %1 > 4
+    push        r14
     mov         r14, r8
+%endif
+%if %1 > 5
+    push        r15
     mov         r15, r9
+%endif
 %endmacro
 
-%imacro uncollect_args 0
+%imacro uncollect_args 1
+%if %1 > 5
     pop         r15
+%endif
+%if %1 > 4
     pop         r14
+%endif
+%if %1 > 3
     pop         r13
+%endif
+%if %1 > 2
     pop         r12
+%endif
+%if %1 > 1
     pop         r11
+%endif
     pop         r10
 %endmacro