I am trying the push onto the stack a value which is one less than %ecx.
So I tried this instruction for that:
pushl $(%ecx - 1)
However I get the below error from as.
fact.s: Assembler messages:
fact.s:49: Error: register value used as expression
As a workaround I did the following:
movl %ecx, %edx
subl $1, %edx
pushl %edx
But is there there a way to do it without using extra registers (%edx in this case) ? And in one instruction ?
Two instructions:
pushl %ecx
subl $1, (%esp) # or decl (%esp)
Without extra registers? Sure. dec/push/inc. One instruction? No.
decl %ecx
pushl %ecx
incl %ecx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With