Re: [PATCH 3/4] x86/asm/entry/64: use smaller insns

Borislav Petkov
2015-03-26T09:53:04Z

On Thu, Mar 26, 2015 at 10:37:32AM +0100, Ingo Molnar wrote:
> But here GAS generates the 10-byte opcode even if 'mov $0x12345678,
> %rdi' is used, which is an unforced error.

7 bytes:

48 c7 c7 78 56 34 12 mov $0x12345678,%rdi

which is REX + opcode C7 + ModRM + 4-byte immediate.

If it used the bX opcodes, it would have to use REX prefix too for the
%rdi register which would generate a 10-byte insn then:

0: 48 bf 78 56 43 12 00 mov $0x12435678,%rdi
7: 00 00 00

REX + opcode BF + 8 bytes immediate.

So I think using the REX register "rdi" forces it to use the REX prefix
and thus the longer instructions.

All IMHO of course.

--
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--