%macro SUB8x8_DCT8 0
cglobal sub8x8_dct8, 3,3,14
-%if WIN64
- call .skip_prologue
- RET
-%endif
+ TAIL_CALL .skip_prologue, 0
global current_function %+ .skip_prologue
.skip_prologue:
LOAD_DIFF8x4 0,1,2,3, none,none, r1, r2
%macro ADD8x8_IDCT8 0
cglobal add8x8_idct8, 2,2,16
add r1, 128
-%if WIN64
- call .skip_prologue
- RET
-%endif
+ TAIL_CALL .skip_prologue, 0
global current_function %+ .skip_prologue
.skip_prologue:
mova m0, [r1-128]
%if cpuflag(ssse3)
mova m7, [hsub_mul]
%endif
-%if WIN64
- call .skip_prologue
- RET
-%endif
+ TAIL_CALL .skip_prologue, 0
global current_function %+ .skip_prologue
.skip_prologue:
SWAP 7, 9
%if cpuflag(ssse3)
mova m7, [hsub_mul]
%endif
-%if WIN64
- call .skip_prologue
- RET
-%endif
+ TAIL_CALL .skip_prologue, 0
global current_function %+ .skip_prologue
.skip_prologue:
SWAP 7, 10
cglobal add8x8_idct8, 2,2,11
add r0, 4*FDEC_STRIDE
pxor m7, m7
-%if WIN64
- call .skip_prologue
- RET
-%endif
+ TAIL_CALL .skip_prologue, 0
global current_function %+ .skip_prologue
.skip_prologue:
SWAP 7, 9
cglobal add8x8_idct, 2,2,11
add r0, 4*FDEC_STRIDE
pxor m7, m7
-%if WIN64
- call .skip_prologue
- RET
-%endif
+ TAIL_CALL .skip_prologue, 0
global current_function %+ .skip_prologue
.skip_prologue:
SWAP 7, 9
add r0, %3
add r1, %4-%5-%6*FENC_STRIDE
add r2, %4-%5-%6*FDEC_STRIDE
-%if WIN64
- call %2.skip_prologue
- RET
-%else
- jmp %2.skip_prologue
-%endif
+ TAIL_CALL %2.skip_prologue, 1
%endmacro
;-----------------------------------------------------------------------------
call %2.skip_prologue
add r0, %4-%5-%6*FDEC_STRIDE
add r1, %3
-%if WIN64
- call %2.skip_prologue
- RET
-%else
- jmp %2.skip_prologue
-%endif
+ TAIL_CALL %2.skip_prologue, 1
%endmacro
%if HIGH_BIT_DEPTH
cglobal add16x16_idct_dc, 2,2,8
call .loop
add r0, FDEC_STRIDE*4
-%if WIN64
- call .loop
- RET
-%endif
+ TAIL_CALL .loop, 0
.loop:
add r0, FDEC_STRIDE*4
movq m0, [r1+0]
cglobal add16x16_idct_dc, 2,2,8
call .loop
add r0, FDEC_STRIDE*4
-%if WIN64
- call .loop
- RET
-%endif
+ TAIL_CALL .loop, 0
.loop:
add r0, FDEC_STRIDE*4
mova m0, [r1]
%else
lea r6, [avg_w16_addr + r6]
%endif
-%if UNIX64
- jmp r6
-%else
- call r6
- RET
-%endif
+ TAIL_CALL r6, 1
%assign j 0
%assign k 1
%assign xmm_regs_used 0
%endmacro
+%define has_epilogue regs_used > 7 || xmm_regs_used > 6
+
%macro RET 0
WIN64_RESTORE_XMM_INTERNAL rsp
POP_IF_USED 14, 13, 12, 11, 10, 9, 8, 7
ret
%endmacro
-%macro REP_RET 0
- %if regs_used > 7 || xmm_regs_used > 6
- RET
- %else
- rep ret
- %endif
-%endmacro
-
%elif ARCH_X86_64 ; *nix x64 ;=============================================
DECLARE_REG 0, rdi
DEFINE_ARGS %4
%endmacro
+%define has_epilogue regs_used > 9
+
%macro RET 0
POP_IF_USED 14, 13, 12, 11, 10, 9
ret
%endmacro
-%macro REP_RET 0
- %if regs_used > 9
- RET
- %else
- rep ret
- %endif
-%endmacro
-
%else ; X86_32 ;==============================================================
DECLARE_REG 0, eax, 4
DEFINE_ARGS %4
%endmacro
+%define has_epilogue regs_used > 3
+
%macro RET 0
POP_IF_USED 6, 5, 4, 3
ret
%endmacro
-%macro REP_RET 0
- %if regs_used > 3
- RET
- %else
- rep ret
- %endif
-%endmacro
-
%endif ;======================================================================
%if WIN64 == 0
%endmacro
%endif
+%macro REP_RET 0
+ %if has_epilogue
+ RET
+ %else
+ rep ret
+ %endif
+%endmacro
+
+%macro TAIL_CALL 2 ; callee, is_nonadjacent
+ %if has_epilogue
+ call %1
+ RET
+ %elif %2
+ jmp %1
+ %endif
+%endmacro
+
;=============================================================================
; arch-independent part
;=============================================================================