[Nasm-bugs] [Bug 3392788] New: Missing size optimization in mov [ebp + ecx]

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Wed Nov 24 04:28:39 PST 2021


https://bugzilla.nasm.us/show_bug.cgi?id=3392788

            Bug ID: 3392788
           Summary: Missing size optimization in mov [ebp + ecx]
           Product: NASM
           Version: 2.15.xx
          Hardware: PC
                OS: Linux
            Status: OPEN
          Severity: normal
          Priority: Medium
         Component: Assembler
          Assignee: nobody at nasm.us
          Reporter: negge at dgql.org
                CC: chang.seok.bae at intel.com, gorcunov at gmail.com,
                    hpa at zytor.com, nasm-bugs at nasm.us
     Obtained from: From OS distribution

I was surprised to see that nasm did not output the smaller, equivalent
instruction when assembling mov [ebp + ecx]. The following two are semantically
the same, but mov [ecx + ebp] is one byte smaller.

$ cat mov.asm
BITS 32
mov ch, [ecx + ebp]
mov ch, [ebp + ecx]

$ nasm mov.asm -o mov.bin

$ ndisasm -b32 mov.bin
00000000  8A2C29            mov ch,[ecx+ebp]
00000003  8A6C0D00          mov ch,[ebp+ecx+0x0]

I am running gentoo and compiled this from source using the OS package manager
portage:

# genlop nasm
 * dev-lang/nasm

     Sun Mar 21 12:43:05 2021 >>> dev-lang/nasm-2.15.05

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.


More information about the Nasm-bugs mailing list