Commit e4b5a204 authored by Mans Rullgard's avatar Mans Rullgard

x86: h264: remove hardcoded eax in decode_significance[_8x8]_x86()

Signed-off-by: default avatarMans Rullgard <mans@mansr.com>
parent 3146a30e
......@@ -42,7 +42,7 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
void *end= significant_coeff_ctx_base + max_coeff - 1;
int minusstart= -(int)significant_coeff_ctx_base;
int minusindex= 4-(int)index;
int coeff_count;
x86_reg coeff_count;
int low;
__asm__ volatile(
"movl %a9(%4), %%esi \n\t"
......@@ -51,42 +51,42 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
"2: \n\t"
BRANCHLESS_GET_CABAC("%%edx", "%4", "(%1)", "%3",
"%w3", "%%esi", "%%eax", "%%al", "%a11")
"%w3", "%%esi", "%k0", "%b0", "%a11")
"test $1, %%edx \n\t"
" jz 3f \n\t"
"add %8, %1 \n\t"
BRANCHLESS_GET_CABAC("%%edx", "%4", "(%1)", "%3",
"%w3", "%%esi", "%%eax", "%%al", "%a11")
"%w3", "%%esi", "%k0", "%b0", "%a11")
"sub %8, %1 \n\t"
"mov %2, %%"REG_a" \n\t"
"mov %2, %0 \n\t"
"movl %5, %%ecx \n\t"
"add %1, %%"REG_c" \n\t"
"movl %%ecx, (%%"REG_a") \n\t"
"movl %%ecx, (%0) \n\t"
"test $1, %%edx \n\t"
" jnz 4f \n\t"
"add $4, %%"REG_a" \n\t"
"mov %%"REG_a", %2 \n\t"
"add $4, %0 \n\t"
"mov %0, %2 \n\t"
"3: \n\t"
"add $1, %1 \n\t"
"cmp %6, %1 \n\t"
" jb 2b \n\t"
"mov %2, %%"REG_a" \n\t"
"mov %2, %0 \n\t"
"movl %5, %%ecx \n\t"
"add %1, %%"REG_c" \n\t"
"movl %%ecx, (%%"REG_a") \n\t"
"movl %%ecx, (%0) \n\t"
"4: \n\t"
"add %7, %%eax \n\t"
"shr $2, %%eax \n\t"
"add %7, %k0 \n\t"
"shr $2, %k0 \n\t"
"movl %%esi, %a9(%4) \n\t"
"movl %3, %a10(%4) \n\t"
:"=&a"(coeff_count), "+r"(significant_coeff_ctx_base), "+m"(index),
:"=&r"(coeff_count), "+r"(significant_coeff_ctx_base), "+m"(index),
"=&r"(low)
:"r"(c), "m"(minusstart), "m"(end), "m"(minusindex), "m"(last_off),
"i"(offsetof(CABACContext, range)), "i"(offsetof(CABACContext, low)),
......@@ -100,7 +100,7 @@ static int decode_significance_8x8_x86(CABACContext *c,
uint8_t *significant_coeff_ctx_base,
int *index, x86_reg last_off, const uint8_t *sig_off){
int minusindex= 4-(int)index;
int coeff_count;
x86_reg coeff_count;
int low;
x86_reg last=0;
__asm__ volatile(
......@@ -110,12 +110,12 @@ static int decode_significance_8x8_x86(CABACContext *c,
"mov %1, %%"REG_D" \n\t"
"2: \n\t"
"mov %7, %%"REG_a" \n\t"
"movzbl (%%"REG_a", %%"REG_D"), %%edi \n\t"
"mov %7, %0 \n\t"
"movzbl (%0, %%"REG_D"), %%edi \n\t"
"add %6, %%"REG_D" \n\t"
BRANCHLESS_GET_CABAC("%%edx", "%4", "(%%"REG_D")", "%3",
"%w3", "%%esi", "%%eax", "%%al", "%a11")
"%w3", "%%esi", "%k0", "%b0", "%a11")
"mov %1, %%edi \n\t"
"test $1, %%edx \n\t"
......@@ -126,32 +126,32 @@ static int decode_significance_8x8_x86(CABACContext *c,
"add %8, %%"REG_D" \n\t"
BRANCHLESS_GET_CABAC("%%edx", "%4", "(%%"REG_D")", "%3",
"%w3", "%%esi", "%%eax", "%%al", "%a11")
"%w3", "%%esi", "%k0", "%b0", "%a11")
"mov %2, %%"REG_a" \n\t"
"mov %2, %0 \n\t"
"mov %1, %%edi \n\t"
"movl %%edi, (%%"REG_a") \n\t"
"movl %%edi, (%0) \n\t"
"test $1, %%edx \n\t"
" jnz 4f \n\t"
"add $4, %%"REG_a" \n\t"
"mov %%"REG_a", %2 \n\t"
"add $4, %0 \n\t"
"mov %0, %2 \n\t"
"3: \n\t"
"addl $1, %%edi \n\t"
"mov %%edi, %1 \n\t"
"cmpl $63, %%edi \n\t"
" jb 2b \n\t"
"mov %2, %%"REG_a" \n\t"
"movl %%edi, (%%"REG_a") \n\t"
"mov %2, %0 \n\t"
"movl %%edi, (%0) \n\t"
"4: \n\t"
"addl %5, %%eax \n\t"
"shr $2, %%eax \n\t"
"addl %5, %k0 \n\t"
"shr $2, %k0 \n\t"
"movl %%esi, %a9(%4) \n\t"
"movl %3, %a10(%4) \n\t"
:"=&a"(coeff_count),"+m"(last), "+m"(index), "=&r"(low)
:"=&r"(coeff_count),"+m"(last), "+m"(index), "=&r"(low)
:"r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base), "m"(sig_off), "m"(last_off),
"i"(offsetof(CABACContext, range)), "i"(offsetof(CABACContext, low)),
"i"(offsetof(CABACContext, bytestream))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment