"Ronald S. Bultje" <[email protected]> writes:

> Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
> ---
>  libavcodec/x86/cabac.h     |   15 ++++++++++-----
>  libavcodec/x86/h264_i386.h |   18 ++++++++++++------
>  2 files changed, 22 insertions(+), 11 deletions(-)
>
> diff --git a/libavcodec/x86/cabac.h b/libavcodec/x86/cabac.h
> index 78d8af7..082395c 100644
> --- a/libavcodec/x86/cabac.h
> +++ b/libavcodec/x86/cabac.h
> @@ -51,7 +51,7 @@
>          "xor    "tmp"       , "ret"     \n\t"
>  #endif /* HAVE_FAST_CMOV */
>
> -#define BRANCHLESS_GET_CABAC(ret, statep, low, lowword, range, tmp, tmpbyte, 
> byte) \
> +#define BRANCHLESS_GET_CABAC(ret, statep, low, lowword, range, tmp, tmpbyte, 
> byte, end) \
>          "movzbl "statep"    , "ret"                                 \n\t"\
>          "mov    "range"     , "tmp"                                 \n\t"\
>          "and    $0xC0       , "range"                               \n\t"\
> @@ -64,9 +64,12 @@
>          "shl    %%cl        , "low"                                 \n\t"\
>          "mov    "tmpbyte"   , "statep"                              \n\t"\
>          "test   "lowword"   , "lowword"                             \n\t"\
> -        " jnz   1f                                                  \n\t"\
> +        " jnz   2f                                                  \n\t"\

Why do you renumber these?  Number labels don't need to be in ascending
order or anything like that.

>          "mov    "byte"      , %%"REG_c"                             \n\t"\
> +        "cmp    "end"       , %%"REG_c"                             \n\t"\
> +        "jge    1f                                                  \n\t"\
>          "add"OPSIZE" $2     , "byte"                                \n\t"\
> +        "1:                                                         \n\t"\

Is there no way of doing this with cmov instead of branching?

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to