Пётр Косаревский wrote: > How can I write inline assembler procedure? > > (FPC accepts the word "inline", but generates "call" instruction etc.)
Inline is only a recommendation. > > If there is a way, could anyone point to an example, please? Inlining assembler procedures efficently is rather hard, so we don't do so currently. > > > > > > > Or just remember rotating bits in fpc-devel (if I get it right, they were not > implemented): > > (it's i386, cyclic bitwise longword l shift to the left by c bits; c may be > over 32) > > function lrol(l: longword; c: byte): longword; assembler; inline; // this > thing is not really inline > asm > movb %dl,%cl > roll %cl,%eax > end; // calling register conventions: l->eax, c->dl > > (it generates > .globl P$P_LROL$LONGWORD$BYTE$$LONGWORD > P$P_LROL$LONGWORD$BYTE$$LONGWORD: > # Temps allocated between ebp-4 and ebp-4 > # Register ebp allocated > pushl %ebp > movl %esp,%ebp > subl $4,%esp > # Var l located in register > # Var c located in register > # Temp -4,4 allocated > # Var $result located at ebp-4 > # Register eax,ecx,edx allocated > # [97] movb %dl,%cl > movb %dl,%cl > # [98] roll %cl,%eax > roll %cl,%eax > # Register eax,ecx,edx released > # Temp -4,4 released > leave > # Register ebp released > ret > # Register eax released > > > and > > (moving variables, which could already be in registers) > call P$P_LROL$LONGWORD$BYTE$$LONGWORD > > where it is expected to be inlined) > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal