[llvm-bugs] [Bug 25003] New: x86-64 assembler: using traditional 8-bit regs DH, CH, AH, BH with REX instructions should error

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 30 12:49:18 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25003

            Bug ID: 25003
           Summary: x86-64 assembler: using traditional 8-bit regs
                    DH,CH,AH,BH with REX instructions should error
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: reuben.scratton at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

This might not be considered a bug per se, but it's something I feel the LLVM
assembler could and should treat as an error. 

I am an x86-64 n00b and was today been porting some i386 assembly code to it.
While it was mostly straightforward I was caught out by trying to do this:

    movzxb rsi, dh

The original 32-bit instruction was 'movzxb esi, dh', and I'd naively just
changed 'esi' to 'rsi'. What I didn't realise is that the x86-64 assembler
would compile 'dh' (byte 1 of rdx) as 'sil' (byte 0 of rsi), i.e. the emitted
instruction was 'movzxb rsi, sil'.

Since my desired instruction cannot be assembled, I feel the assembler would be
better to report an error rather than quietly switch to using a totally
different 8-bit register. It would have saved some hours of debug time. :)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150930/4ec15d34/attachment.html>


More information about the llvm-bugs mailing list