Claudio Daffra
2006-03-02 00:25:01 UTC
hi all
in this example, guide-line of amd64 suggest to put a "rep ret"
instruction
at the end of the loop.
... They recommend this particular combination to avoid making the ret
istruction
be target of a conditional jump instruction. ...
in this case "ret" is preceded by a "jg" instruction and
in the event the jump condition does not hold (?!) the program "falls
through" (!?) to the return.
According with to AMD ... bla bla bla ...
my question is :
what real happens ?
i have no mean can u explain me ?
regards
claudio
int fact_dw( int x ) #1 fact_dw:
[
int result = 1 ; #2 movl $1,%eax
.l2
do [
result *= x ; #3 imul %edi,%eax
x-- ; #4 decl %edi
] while (x>0) ; #5 testl %edi,%edi
#6 jg .l2
return result ;
in this example, guide-line of amd64 suggest to put a "rep ret"
instruction
at the end of the loop.
... They recommend this particular combination to avoid making the ret
istruction
be target of a conditional jump instruction. ...
in this case "ret" is preceded by a "jg" instruction and
in the event the jump condition does not hold (?!) the program "falls
through" (!?) to the return.
According with to AMD ... bla bla bla ...
my question is :
what real happens ?
i have no mean can u explain me ?
regards
claudio
int fact_dw( int x ) #1 fact_dw:
[
int result = 1 ; #2 movl $1,%eax
.l2
do [
result *= x ; #3 imul %edi,%eax
x-- ; #4 decl %edi
] while (x>0) ; #5 testl %edi,%edi
#6 jg .l2
return result ;