the code like this: 
 
unsigned short swap16(unsigned short x) 
{ 
    asm volatile ("xchgb %b0, %h0" : "=q" (x) : "0" (x)); 
    return x; 
} 
 
produces: 
 
swap16: xchgb   %dil, %di   <== %di isn't valid high 8-bit form. 
        movzwl  %di,  %eax 
        ret 
 
IIRC the %rdi, %rsi, %rsp, %rbp haven't a high 8-bit form.

-- 
           Summary: gcc emits invalid operands for xchgb %b0, %h0
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at pld-linux dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: amd64-pld-linux
  GCC host triplet: amd64-pld-linux
GCC target triplet: amd64-pld-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21398

Reply via email to