comparison cabac.h @ 8031:eebc7209c47f libavcodec

Convert asm keyword into __asm__. Neither the asm() nor the __asm__() keyword is part of the C99 standard, but while GCC accepts the former in C89 syntax, it is not accepted in C99 unless GNU extensions are turned on (with -fasm). The latter form is accepted in any syntax as an extension (without requiring further command-line options). Sun Studio C99 compiler also does not accept asm() while accepting __asm__(), albeit reporting warnings that it's not valid C99 syntax.
author flameeyes
date Thu, 16 Oct 2008 13:34:09 +0000
parents dc8d9cc3369e
children 7a463923ecd1
comparison
equal deleted inserted replaced
8030:a512ac8fa540 8031:eebc7209c47f
302 static inline void renorm_cabac_decoder_once(CABACContext *c){ 302 static inline void renorm_cabac_decoder_once(CABACContext *c){
303 #ifdef ARCH_X86_DISABLED 303 #ifdef ARCH_X86_DISABLED
304 int temp; 304 int temp;
305 #if 0 305 #if 0
306 //P3:683 athlon:475 306 //P3:683 athlon:475
307 asm( 307 __asm__(
308 "lea -0x100(%0), %2 \n\t" 308 "lea -0x100(%0), %2 \n\t"
309 "shr $31, %2 \n\t" //FIXME 31->63 for x86-64 309 "shr $31, %2 \n\t" //FIXME 31->63 for x86-64
310 "shl %%cl, %0 \n\t" 310 "shl %%cl, %0 \n\t"
311 "shl %%cl, %1 \n\t" 311 "shl %%cl, %1 \n\t"
312 : "+r"(c->range), "+r"(c->low), "+c"(temp) 312 : "+r"(c->range), "+r"(c->low), "+c"(temp)
313 ); 313 );
314 #elif 0 314 #elif 0
315 //P3:680 athlon:474 315 //P3:680 athlon:474
316 asm( 316 __asm__(
317 "cmp $0x100, %0 \n\t" 317 "cmp $0x100, %0 \n\t"
318 "setb %%cl \n\t" //FIXME 31->63 for x86-64 318 "setb %%cl \n\t" //FIXME 31->63 for x86-64
319 "shl %%cl, %0 \n\t" 319 "shl %%cl, %0 \n\t"
320 "shl %%cl, %1 \n\t" 320 "shl %%cl, %1 \n\t"
321 : "+r"(c->range), "+r"(c->low), "+c"(temp) 321 : "+r"(c->range), "+r"(c->low), "+c"(temp)
322 ); 322 );
323 #elif 1 323 #elif 1
324 int temp2; 324 int temp2;
325 //P3:665 athlon:517 325 //P3:665 athlon:517
326 asm( 326 __asm__(
327 "lea -0x100(%0), %%eax \n\t" 327 "lea -0x100(%0), %%eax \n\t"
328 "cltd \n\t" 328 "cltd \n\t"
329 "mov %0, %%eax \n\t" 329 "mov %0, %%eax \n\t"
330 "and %%edx, %0 \n\t" 330 "and %%edx, %0 \n\t"
331 "and %1, %%edx \n\t" 331 "and %1, %%edx \n\t"
334 : "+r"(c->range), "+r"(c->low), "+a"(temp), "+d"(temp2) 334 : "+r"(c->range), "+r"(c->low), "+a"(temp), "+d"(temp2)
335 ); 335 );
336 #elif 0 336 #elif 0
337 int temp2; 337 int temp2;
338 //P3:673 athlon:509 338 //P3:673 athlon:509
339 asm( 339 __asm__(
340 "cmp $0x100, %0 \n\t" 340 "cmp $0x100, %0 \n\t"
341 "sbb %%edx, %%edx \n\t" 341 "sbb %%edx, %%edx \n\t"
342 "mov %0, %%eax \n\t" 342 "mov %0, %%eax \n\t"
343 "and %%edx, %0 \n\t" 343 "and %%edx, %0 \n\t"
344 "and %1, %%edx \n\t" 344 "and %1, %%edx \n\t"
347 : "+r"(c->range), "+r"(c->low), "+a"(temp), "+d"(temp2) 347 : "+r"(c->range), "+r"(c->low), "+a"(temp), "+d"(temp2)
348 ); 348 );
349 #else 349 #else
350 int temp2; 350 int temp2;
351 //P3:677 athlon:511 351 //P3:677 athlon:511
352 asm( 352 __asm__(
353 "cmp $0x100, %0 \n\t" 353 "cmp $0x100, %0 \n\t"
354 "lea (%0, %0), %%eax \n\t" 354 "lea (%0, %0), %%eax \n\t"
355 "lea (%1, %1), %%edx \n\t" 355 "lea (%1, %1), %%edx \n\t"
356 "cmovb %%eax, %0 \n\t" 356 "cmovb %%eax, %0 \n\t"
357 "cmovb %%edx, %1 \n\t" 357 "cmovb %%edx, %1 \n\t"
383 #endif 383 #endif
384 #if defined(ARCH_X86) && defined(HAVE_7REGS) && defined(HAVE_EBX_AVAILABLE) && !defined(BROKEN_RELOCATIONS) 384 #if defined(ARCH_X86) && defined(HAVE_7REGS) && defined(HAVE_EBX_AVAILABLE) && !defined(BROKEN_RELOCATIONS)
385 int bit; 385 int bit;
386 386
387 #ifndef BRANCHLESS_CABAC_DECODER 387 #ifndef BRANCHLESS_CABAC_DECODER
388 asm volatile( 388 __asm__ volatile(
389 "movzbl (%1), %0 \n\t" 389 "movzbl (%1), %0 \n\t"
390 "movl "RANGE "(%2), %%ebx \n\t" 390 "movl "RANGE "(%2), %%ebx \n\t"
391 "movl "RANGE "(%2), %%edx \n\t" 391 "movl "RANGE "(%2), %%edx \n\t"
392 "andl $0xC0, %%ebx \n\t" 392 "andl $0xC0, %%ebx \n\t"
393 "movzbl "MANGLE(ff_h264_lps_range)"(%0, %%ebx, 2), %%esi\n\t" 393 "movzbl "MANGLE(ff_h264_lps_range)"(%0, %%ebx, 2), %%esi\n\t"
522 "add $7 , %%ecx \n\t"\ 522 "add $7 , %%ecx \n\t"\
523 "shl %%cl , "tmp" \n\t"\ 523 "shl %%cl , "tmp" \n\t"\
524 "add "tmp" , "low" \n\t"\ 524 "add "tmp" , "low" \n\t"\
525 "1: \n\t" 525 "1: \n\t"
526 526
527 asm volatile( 527 __asm__ volatile(
528 "movl "RANGE "(%2), %%esi \n\t" 528 "movl "RANGE "(%2), %%esi \n\t"
529 "movl "LOW "(%2), %%ebx \n\t" 529 "movl "LOW "(%2), %%ebx \n\t"
530 BRANCHLESS_GET_CABAC("%0", "%2", "(%1)", "%%ebx", "%%bx", "%%esi", "%%edx", "%%dl") 530 BRANCHLESS_GET_CABAC("%0", "%2", "(%1)", "%%ebx", "%%bx", "%%esi", "%%edx", "%%dl")
531 "movl %%esi, "RANGE "(%2) \n\t" 531 "movl %%esi, "RANGE "(%2) \n\t"
532 "movl %%ebx, "LOW "(%2) \n\t" 532 "movl %%ebx, "LOW "(%2) \n\t"
589 } 589 }
590 590
591 static int av_unused get_cabac_bypass(CABACContext *c){ 591 static int av_unused get_cabac_bypass(CABACContext *c){
592 #if 0 //not faster 592 #if 0 //not faster
593 int bit; 593 int bit;
594 asm volatile( 594 __asm__ volatile(
595 "movl "RANGE "(%1), %%ebx \n\t" 595 "movl "RANGE "(%1), %%ebx \n\t"
596 "movl "LOW "(%1), %%eax \n\t" 596 "movl "LOW "(%1), %%eax \n\t"
597 "shl $17, %%ebx \n\t" 597 "shl $17, %%ebx \n\t"
598 "add %%eax, %%eax \n\t" 598 "add %%eax, %%eax \n\t"
599 "sub %%ebx, %%eax \n\t" 599 "sub %%ebx, %%eax \n\t"
636 } 636 }
637 637
638 638
639 static av_always_inline int get_cabac_bypass_sign(CABACContext *c, int val){ 639 static av_always_inline int get_cabac_bypass_sign(CABACContext *c, int val){
640 #if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) 640 #if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__))
641 asm volatile( 641 __asm__ volatile(
642 "movl "RANGE "(%1), %%ebx \n\t" 642 "movl "RANGE "(%1), %%ebx \n\t"
643 "movl "LOW "(%1), %%eax \n\t" 643 "movl "LOW "(%1), %%eax \n\t"
644 "shl $17, %%ebx \n\t" 644 "shl $17, %%ebx \n\t"
645 "add %%eax, %%eax \n\t" 645 "add %%eax, %%eax \n\t"
646 "sub %%ebx, %%eax \n\t" 646 "sub %%ebx, %%eax \n\t"