Move immediate 8-bit value into RSI, RDI, RSP or RBP

46 Views Asked by At

I took a look at the opcodes generated by these assembly codes :

xor rsi, rsi
mov sil, 0xFF

and

mov rsi, 0xFF

The first code turns into 48 31 F6 40 B6 FF and the second into 48 C7 C6 FF 00 00 00.

  1. Is code with more instructions slower?
  2. Is what matters more the size taken up by the opcodes?
  3. Which code produces the highest performance?

EDIT: in the comments I saw mov esi, 0xFF is a better solution and in a way it is a good answer. I am not sure about this question but what if we look only at the codes I wrote?

0

There are 0 best solutions below