[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gas/22871] Encode instructions of 64-bit operand without the REX_W
From: |
address@hidden |
Subject: |
[Bug gas/22871] Encode instructions of 64-bit operand without the REX_W bit |
Date: |
Thu, 22 Feb 2018 18:10:51 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=22871
--- Comment #9 from Linus Torvalds <address@hidden> ---
I already pointed this out in email to hjl, but adding it to the bugzilla too,
in case people want to track it:
There are a few more common cases that can use the REX.W optimization, notably
movq $imm,%reg
and there it actually allows the whole unsigned 32-bit range, so it changes the
immediate logic a bit.
Right now gas generates a 10-byte instruction for
movq $0x87654321,%rax
in the form of
0: 48 b8 21 43 65 87 00 movabs $0x87654321,%rax
7: 00 00 00
but you can actually do it with just 5 bytes:
0: b8 21 43 65 87 mov $0x87654321,%eax
instead. Note that the C7/0 instruction with REX.W wasn't used,
because it sign-extends the 32-bit constant.
But even when the constant *isn't* in the full 32-bit range and you can use
C7/0 to avoid the long constant, gas currently picks a non-optimal instruction:
movq $0x77654321,%rax
becomes
0: 48 c7 c0 21 43 65 77 mov $0x77654321,%rax
which is 7 bytes, even though (again) that 5-byte 32-bit mov would
have sufficed:
0: b8 21 43 65 77 mov $0x77654321,%eax
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug gas/22871] Encode instructions of 64-bit registers without the REX_W bit, (continued)
- [Bug gas/22871] Encode instructions of 64-bit registers without the REX_W bit, hjl.tools at gmail dot com, 2018/02/21
- [Bug gas/22871] Encode instructions of 64-bit registers without the REX_W bit, jbeulich at novell dot com, 2018/02/21
- [Bug gas/22871] Encode instructions of 64-bit registers without the REX_W bit, hjl.tools at gmail dot com, 2018/02/21
- [Bug gas/22871] Encode instructions of 64-bit registers without the REX_W bit, hjl.tools at gmail dot com, 2018/02/21
- [Bug gas/22871] Encode instructions of 64-bit operand without the REX_W bit, hjl.tools at gmail dot com, 2018/02/21
- [Bug gas/22871] Encode instructions of 64-bit operand without the REX_W bit, address@hidden, 2018/02/21
- [Bug gas/22871] Encode instructions of 64-bit operand without the REX_W bit, hjl.tools at gmail dot com, 2018/02/21
- [Bug gas/22871] Encode instructions of 64-bit operand without the REX_W bit, jbeulich at novell dot com, 2018/02/22
- [Bug gas/22871] Encode instructions of 64-bit operand without the REX_W bit, hjl.tools at gmail dot com, 2018/02/22
- [Bug gas/22871] Encode instructions of 64-bit operand without the REX_W bit, hjl.tools at gmail dot com, 2018/02/22
- [Bug gas/22871] Encode instructions of 64-bit operand without the REX_W bit,
address@hidden <=
- [Bug gas/22871] Encode instructions of 64-bit operand without the REX_W bit, address@hidden, 2018/02/22
- [Bug gas/22871] Encode instructions of 64-bit operand without the REX_W bit, hjl.tools at gmail dot com, 2018/02/22
- [Bug gas/22871] Encode instructions of 64-bit operand without the REX_W bit, address@hidden, 2018/02/22
- [Bug gas/22871] Encode instructions of 64-bit operand without the REX_W bit, jbeulich at novell dot com, 2018/02/23
- [Bug gas/22871] Encode instructions of 64-bit operand without the REX_W bit, hjl.tools at gmail dot com, 2018/02/23
- [Bug gas/22871] Encode instructions of 64-bit operand without the REX_W bit, hjl.tools at gmail dot com, 2018/02/23
- [Bug gas/22871] Encode instructions of 64-bit operand without the REX_W bit, address@hidden, 2018/02/23
- [Bug gas/22871] Encode instructions of 64-bit operand without the REX_W bit, hjl.tools at gmail dot com, 2018/02/23
- [Bug gas/22871] Encode instructions of 64-bit operand without the REX_W bit, address@hidden, 2018/02/23
- [Bug gas/22871] Encode instructions of 64-bit operand without the REX_W bit, address@hidden, 2018/02/23