Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I extract a single byte from an xmm-register in Asm?

I was learning SSE-instructions and found a weird error with GNU's as assembler, when trying to copy a single byte from an xmm-register to al: "Error: operand type mismatch for pextrb".

I think my syntax is right, it works perfectly fine with pextrd.

pextrd $3, %xmm0, %eax  # Works perfectly fine
pextrb $3, %xmm0, %al   # Error: operand type mismatch for 'pextrb'
like image 989
Ich445 Avatar asked Feb 04 '26 11:02

Ich445


1 Answers

Marc Glisse is right, it works when using eax instead of al. It is zero-extended, so eax actually contains only the one single byte. Thank you!

pextrb $3, %xmm0, %eax
like image 139
Ich445 Avatar answered Feb 06 '26 03:02

Ich445



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!