assembly - GAS Assembler operand type mismatch for `cmovz' -
i trying write simple assembly program. reason conditional moves seem give me error. if replace them normal mov instruction works. wrong following code?
.section .data supported: .asciz "avx supported" notsupported: .asciz "avx not supported" .section .text .global main main: movq $1, %rax cpuid andq $0x10000000, %rcx cmovnz $supported, %rdi cmovz $notsupported, %rdi callq puts movq $0, %rax ret cpuid.s:15: error: operand type mismatch `cmovnz' cpuid.s:16: error: operand type mismatch `cmovz'
if @ description of cmovcc
in intel's manual you'll see source operand needs r/m64
(i.e. 64-bit register or memory location). $supported
, $notsupported
immediates, , therefore not qualify r/m64
.
you this:
movabs $notsupported,%rdi movabs $supported,%rbx testq $0x10000000, %rcx # checks desired bit without clobbering %rcx cmovnz %rbx,%rdi
Comments
Post a Comment