[PATCH][x86 inline-asm] Fix printing of register operands with q modifier

Akira Hatanaka ahatanak at gmail.com
Fri Mar 28 11:58:09 PDT 2014


The attached patch changes the behavior of function printAsmMRegister to
emit 32-bit register names instead of 64-bit register names if the target
does not have 64-bit general purpose registers.

This is what gcc apparently does and some of the open source libraries seem
to rely on this behavior.

ToT clang complains when it tries to compile the following code:

$ cat inline-asm-modifier-q.c
void q_modifier(int *p) {
  asm ("movq (%q0, %%ebx, 4), %%mm0" : : "r" (p));
}

$ clang -m32 -c inline-asm-modifier-q.c
inline-asm-modifier-q.c:2:8: error: register %rax is only available in
64-bit
      mode
  asm ("movq (%q0, %%ebx, 4), %%mm0" : : "r" (p));
       ^
<inline asm>:1:8: note: instantiated into assembly here
        movq (%rax, %ebx, 4), %mm0
              ^~~~~

Please review.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140328/f9853f62/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qmod1.patch
Type: text/x-patch
Size: 1404 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140328/f9853f62/attachment.bin>


More information about the llvm-commits mailing list