Opened 12 years ago

Closed 11 years ago

#52 closed enhancement (fixed)

shorter encodings for movl $imm32, %reg and movw $imm16, %reg

Reported by: rme Owned by: rme
Priority: minor Milestone:
Component: Compiler Version: 1.1
Keywords: Cc:

Description

It looks like we could save a byte of space by using a shorter encoding of MOV in the following cases.

Images built with this change applied seem to work fine. The images are abut 28K smaller---a savings of about 0.2%, if it's even meaningful to make such comparisons.

$ svn diff x86-asm.lisp 
Index: x86-asm.lisp
===================================================================
--- x86-asm.lisp        (revision 7024)
+++ x86-asm.lisp        (working copy)
@@ -1877,8 +1877,8 @@
      #x8b #o0 #x00)
    (def-x8664-opcode movl ((:reg32 :insert-modrm-reg) (:anymem :insert-memory))
      #x89 #o0 #x00)
-   (def-x8664-opcode movl ((:imm32s :insert-imm32s) (:reg32 :insert-modrm-rm))
-     #xc7 #o300 #x00)
+   (def-x8664-opcode movl ((:imm32s :insert-imm32s) (:reg32 :insert-opcode-reg))
+     #xb8 nil #x00)
    (def-x8664-opcode movl ((:imm32s :insert-imm32s) (:anymem :insert-memory))
      #xc7 #o000 #x00)
 
@@ -1889,8 +1889,8 @@
      #x8b #o0 #x00  #x66)
    (def-x8664-opcode movw ((:reg16 :insert-modrm-reg) (:anymem :insert-memory))
      #x89 #o0 #x00 #x66)
-   (def-x8664-opcode movw ((:imm16 :insert-imm16) (:reg16 :insert-modrm-rm))
-     #xc7 #o300 #x00 #x66)
+   (def-x8664-opcode movw ((:imm16 :insert-imm16) (:reg16 :insert-opcode-reg))
+     #xb8 nil #x00 #x66)
    (def-x8664-opcode movw ((:imm16 :insert-imm16) (:anymem :insert-memory))
      #xc7 #o000 #x00 #x66)

Change History (2)

comment:1 Changed 11 years ago by rme

  • Owner changed from gb to rme
  • Status changed from new to assigned

comment:2 Changed 11 years ago by rme

  • Resolution set to fixed
  • Status changed from assigned to closed

In the trunk as of r10188, as least.

Note: See TracTickets for help on using tickets.