Mercurial > libavcodec.hg
comparison x86/x86inc.asm @ 10433:669965580b72 libavcodec
sync yasm macros to x264
author | lorenm |
---|---|
date | Sun, 18 Oct 2009 21:42:28 +0000 |
parents | 12c8175d6db5 |
children | 980030a3e315 |
comparison
equal
deleted
inserted
replaced
10432:227077518e00 | 10433:669965580b72 |
---|---|
51 ; x86_64 can't fit 64bit address literals in most instruction types, | 51 ; x86_64 can't fit 64bit address literals in most instruction types, |
52 ; so shared objects (under the assumption that they might be anywhere | 52 ; so shared objects (under the assumption that they might be anywhere |
53 ; in memory) must use an address mode that does fit. | 53 ; in memory) must use an address mode that does fit. |
54 ; So all accesses to global variables must use this macro, e.g. | 54 ; So all accesses to global variables must use this macro, e.g. |
55 ; mov eax, [foo GLOBAL] | 55 ; mov eax, [foo GLOBAL] |
56 ; instead of | 56 ; instead of |
57 ; mov eax, [foo] | 57 ; mov eax, [foo] |
58 ; | 58 ; |
59 ; x86_32 doesn't require PIC. | 59 ; x86_32 doesn't require PIC. |
60 ; Some distros prefer shared objects to be PIC, but nothing breaks if | 60 ; Some distros prefer shared objects to be PIC, but nothing breaks if |
61 ; the code contains a few textrels, so we'll skip that complexity. | 61 ; the code contains a few textrels, so we'll skip that complexity. |
82 ; %3 = number of xmm registers used. pushes callee-saved xmm regs if needed. | 82 ; %3 = number of xmm registers used. pushes callee-saved xmm regs if needed. |
83 ; %4 = list of names to define to registers | 83 ; %4 = list of names to define to registers |
84 ; PROLOGUE can also be invoked by adding the same options to cglobal | 84 ; PROLOGUE can also be invoked by adding the same options to cglobal |
85 | 85 |
86 ; e.g. | 86 ; e.g. |
87 ; cglobal foo, 2,3, dst, src, tmp | 87 ; cglobal foo, 2,3,0, dst, src, tmp |
88 ; declares a function (foo), taking two args (dst and src) and one local variable (tmp) | 88 ; declares a function (foo), taking two args (dst and src) and one local variable (tmp) |
89 | 89 |
90 ; TODO Some functions can use some args directly from the stack. If they're the | 90 ; TODO Some functions can use some args directly from the stack. If they're the |
91 ; last args then you can just not declare them, but if they're in the middle | 91 ; last args then you can just not declare them, but if they're in the middle |
92 ; we need more flexible macro. | 92 ; we need more flexible macro. |
436 %macro cglobal 1-2+ | 436 %macro cglobal 1-2+ |
437 %xdefine %1 ff_%1 | 437 %xdefine %1 ff_%1 |
438 %ifdef PREFIX | 438 %ifdef PREFIX |
439 %xdefine %1 _ %+ %1 | 439 %xdefine %1 _ %+ %1 |
440 %endif | 440 %endif |
441 %xdefine %1.skip_prologue %1 %+ .skip_prologue | |
441 %ifidn __OUTPUT_FORMAT__,elf | 442 %ifidn __OUTPUT_FORMAT__,elf |
442 global %1:function hidden | 443 global %1:function hidden |
443 %else | 444 %else |
444 global %1 | 445 global %1 |
445 %endif | 446 %endif |
597 LOAD_MM_PERMUTATION %1 | 598 LOAD_MM_PERMUTATION %1 |
598 %endif | 599 %endif |
599 %endmacro | 600 %endmacro |
600 | 601 |
601 ;Substitutions that reduce instruction size but are functionally equivalent | 602 ;Substitutions that reduce instruction size but are functionally equivalent |
602 %define movdqa movaps | |
603 %define movdqu movups | |
604 | |
605 %macro add 2 | 603 %macro add 2 |
606 %ifnum %2 | 604 %ifnum %2 |
607 %if %2==128 | 605 %if %2==128 |
608 sub %1, -128 | 606 sub %1, -128 |
609 %else | 607 %else |