assembly - GAS, MOVQ Throws operand mismatch, when trying to copy rax to mmx register -
i'm using gnu assembly , gcc compiler. have make operations using mmx registers. i've got memory buffer of bytes, i'm reading 1 byte memory %al, making logical , operation , shifting rax left 1 byte , inserting on lower bits next byte memory until %rax gets full. when i'm trying do:
movq %rax, %mm0
compilers throws: error: operand type mismatch `movq'
examples:
this works:
mov $0, %rcx\n" movl , %ecx\n" mov (%1, %rcx, 8), %rbx\n" movq %rbx, %mm0
this don't:
mov (variable_that_contains_address, %rcx, 4), %rax ;get 4 bits memory movb %al, %bl andb $0b00011111, %bl ;only lower 5 bits needed movb %bl, %dl ;store whole byte @ rdx shl $8, %rdx ;make space next byte shr $5, %rax ; need next 5 bits, because data in memory saved not in bytes movb %al, %bl ;next 5 bits ;repating until rdx full (some higher bits unused) movq %rdx, %mm0 ; , compiler throws mismatch error
this code not full code - full code long. it's made intuition.
why hates me much? i'm doing wrong. please don't complain methodology of getting 5 bits, need storing rdx mm0.
movq %rbx, %mm0
give movd
go?
don't forget if need 5 bits can use carry flag 1 byte
shr $5, %rax 10111
will set carry
shr $5, %rax 01110
will not
Comments
Post a Comment