0
votes

Code fragment from Assembly exercise (GNU Assembler, Linux 32 bit)


.data

more:
.asciz "more\n"

.text
...

movl $more, %eax        # this is compiled
cmova more, %eax        # this is compiled
cmova $more, %eax       # this is not compiled

Error: suffix or operands invalid for `cmova'

I can place string address to %eax using movl, but cmova is not compiled. I need the source operand to be $more and not more, to use it for printing. Finally, this value goes to %ecx register of Linux system call 4 (write).

1

1 Answers

3
votes

The assembler is correct! The CMOVcc instructions are more limited than MOV: they can only move 16/32/64-bit values from memory into a register, or from one register to another. They don't support immediate (or 8-bit register) operands.

(Reference: http://www.intel.com/Assets/PDF/manual/253666.pdf - from the set of manuals available at http://www.intel.com/products/processor/manuals/index.htm .)