- replaced hardcoded rcx with REG_c - replaced q modifier with REG_PTR_MOD - one movslq not present in x32 because ret and retq would be identical
Signed-off-by: Matthias Räncker <[email protected]> --- libavcodec/x86/cabac.h | 19 ++++++++++++------- libavcodec/x86/h264_i386.h | 18 +++++++++--------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/libavcodec/x86/cabac.h b/libavcodec/x86/cabac.h index a74cf0b..9a1da8e 100644 --- a/libavcodec/x86/cabac.h +++ b/libavcodec/x86/cabac.h @@ -36,11 +36,16 @@ #define BRANCHLESS_GET_CABAC_UPDATE(ret, retq, low, range, tmp) \ "cmp "low" , "tmp" \n\t"\ "cmova %%ecx , "range" \n\t"\ - "sbb %%rcx , %%rcx \n\t"\ + "sbb %%"REG_c" , %%"REG_c" \n\t"\ "and %%ecx , "tmp" \n\t"\ - "xor %%rcx , "retq" \n\t"\ + "xor %%"REG_c" , "retq" \n\t"\ "sub "tmp" , "low" \n\t" #else /* HAVE_FAST_CMOV */ +#if ARCH_X86_X64 +#define BRANCHLESS_GET_CABAC_UPDATE_SLOW_CMOV_RET_SIGN_EXTEND "movslq "ret" , "retq" \n\t" +#else +#define BRANCHLESS_GET_CABAC_UPDATE_SLOW_CMOV_RET_SIGN_EXTEND +#endif #define BRANCHLESS_GET_CABAC_UPDATE(ret, retq, low, range, tmp) \ /* P4 Prescott has crappy cmov,sbb,64bit shift so avoid them */ \ "sub "low" , "tmp" \n\t"\ @@ -52,7 +57,7 @@ "and "tmp" , %%ecx \n\t"\ "sub %%ecx , "low" \n\t"\ "xor "tmp" , "ret" \n\t"\ - "movslq "ret" , "retq" \n\t" + BRANCHLESS_GET_CABAC_UPDATE_SLOW_CMOV_RET_SIGN_EXTEND #endif /* HAVE_FAST_CMOV */ #define BRANCHLESS_GET_CABAC(ret, retq, statep, low, lowword, range, rangeq, tmp, tmpbyte, byte, end, norm_off, lps_off, mlps_off, tables) \ @@ -60,7 +65,7 @@ "mov "range" , "tmp" \n\t"\ "and $0xC0 , "range" \n\t"\ "lea ("ret", "range", 2), %%ecx \n\t"\ - "movzbl "lps_off"("tables", %%rcx), "range" \n\t"\ + "movzbl "lps_off"("tables", %%"REG_c"), "range" \n\t"\ "sub "range" , "tmp" \n\t"\ "mov "tmp" , %%ecx \n\t"\ "shl $17 , "tmp" \n\t"\ @@ -83,7 +88,7 @@ "shr $15 , %%ecx \n\t"\ "bswap "tmp" \n\t"\ "shr $15 , "tmp" \n\t"\ - "movzbl "norm_off"("tables", %%rcx), %%ecx \n\t"\ + "movzbl "norm_off"("tables", %%"REG_c"), %%ecx \n\t"\ "sub $0xFFFF , "tmp" \n\t"\ "neg %%ecx \n\t"\ "add $7 , %%ecx \n\t"\ @@ -171,8 +176,8 @@ static av_always_inline int get_cabac_inline_x86(CABACContext *c, #endif __asm__ volatile( - BRANCHLESS_GET_CABAC("%0", "%q0", "(%4)", "%1", "%w1", - "%2", "%q2", "%3", "%b3", + BRANCHLESS_GET_CABAC("%0", "%"REG_PTR_MOD"0", "(%4)", "%1", "%w1", + "%2", "%"REG_PTR_MOD"2", "%3", "%b3", "%c6(%5)", "%c7(%5)", AV_STRINGIFY(H264_NORM_SHIFT_OFFSET), AV_STRINGIFY(H264_LPS_RANGE_OFFSET), diff --git a/libavcodec/x86/h264_i386.h b/libavcodec/x86/h264_i386.h index bb881c3..88a6ab7 100644 --- a/libavcodec/x86/h264_i386.h +++ b/libavcodec/x86/h264_i386.h @@ -61,8 +61,8 @@ static int decode_significance_x86(CABACContext *c, int max_coeff, __asm__ volatile( "3: \n\t" - BRANCHLESS_GET_CABAC("%4", "%q4", "(%1)", "%3", "%w3", - "%5", "%q5", "%k0", "%b0", + BRANCHLESS_GET_CABAC("%4", "%"REG_PTR_MOD"4", "(%1)", "%3", "%w3", + "%5", "%"REG_PTR_MOD"5", "%k0", "%b0", "%c11(%6)", "%c12(%6)", AV_STRINGIFY(H264_NORM_SHIFT_OFFSET), AV_STRINGIFY(H264_LPS_RANGE_OFFSET), @@ -73,8 +73,8 @@ static int decode_significance_x86(CABACContext *c, int max_coeff, " jz 4f \n\t" "add %10, %1 \n\t" - BRANCHLESS_GET_CABAC("%4", "%q4", "(%1)", "%3", "%w3", - "%5", "%q5", "%k0", "%b0", + BRANCHLESS_GET_CABAC("%4", "%"REG_PTR_MOD"4", "(%1)", "%3", "%w3", + "%5", "%"REG_PTR_MOD"5", "%k0", "%b0", "%c11(%6)", "%c12(%6)", AV_STRINGIFY(H264_NORM_SHIFT_OFFSET), AV_STRINGIFY(H264_LPS_RANGE_OFFSET), @@ -141,8 +141,8 @@ static int decode_significance_8x8_x86(CABACContext *c, "movzbl (%0, %6), %k6 \n\t" "add %9, %6 \n\t" - BRANCHLESS_GET_CABAC("%4", "%q4", "(%6)", "%3", "%w3", - "%5", "%q5", "%k0", "%b0", + BRANCHLESS_GET_CABAC("%4", "%"REG_PTR_MOD"4", "(%6)", "%3", "%w3", + "%5", "%"REG_PTR_MOD"5", "%k0", "%b0", "%c12(%7)", "%c13(%7)", AV_STRINGIFY(H264_NORM_SHIFT_OFFSET), AV_STRINGIFY(H264_LPS_RANGE_OFFSET), @@ -154,14 +154,14 @@ static int decode_significance_8x8_x86(CABACContext *c, " jz 4f \n\t" #ifdef BROKEN_RELOCATIONS - "movzbl %c14(%15, %q6), %k6\n\t" + "movzbl %c14(%15, %"REG_PTR_MOD"6), %k6\n\t" #else "movzbl "MANGLE(ff_h264_cabac_tables)"+%c14(%k6), %k6\n\t" #endif "add %11, %6 \n\t" - BRANCHLESS_GET_CABAC("%4", "%q4", "(%6)", "%3", "%w3", - "%5", "%q5", "%k0", "%b0", + BRANCHLESS_GET_CABAC("%4", "%"REG_PTR_MOD"4", "(%6)", "%3", "%w3", + "%5", "%"REG_PTR_MOD"5", "%k0", "%b0", "%c12(%7)", "%c13(%7)", AV_STRINGIFY(H264_NORM_SHIFT_OFFSET), AV_STRINGIFY(H264_LPS_RANGE_OFFSET), -- 1.8.1.1 _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
