Use shorter instructions on x86
Describe the feature
We can use shorter instructions on x86 where we're currently using a 32-bit immediate. In some cases we can use an 8-bit immediate because 8-bit immediates are sign-extended.
Is there a prototype?
None.
Describe the feature in more detail
In
!135 (comment 11389)
at instruction df95, we use an and
instruction that is 6 bytes long
for the constant #xfffffff0
. This 6-byte instruction can be replaced
by a 3-byte instruction with an immediate of #xf0 which will be
sign-extended to #xfffffff0
.
This saves some code space.
To be complete, we'll need to examine every instruction that can take a 32-bit immmediate and see if it can be replaced by an 8-bit immediate that can be sign-extended to give the original 32-bit value. But we don't have to do this all at once, fortunately; we can do this one instruction at a time.