<div dir="ltr">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.<div><br></div>
<div>This is what gcc apparently does and some of the open source libraries seem to rely on this behavior.</div><div><br></div><div>ToT clang complains when it tries to compile the following code:<br><br></div><div>$ cat inline-asm-modifier-q.c<br>
</div><div><div>void q_modifier(int *p) {</div><div>  asm ("movq (%q0, %%ebx, 4), %%mm0" : : "r" (p));</div><div>}</div></div><div><br></div><div><div>$ clang -m32 -c inline-asm-modifier-q.c </div><div>
inline-asm-modifier-q.c:2:8: error: register %rax is only available in 64-bit</div><div>      mode</div><div>  asm ("movq (%q0, %%ebx, 4), %%mm0" : : "r" (p));</div><div>       ^</div><div><inline asm>:1:8: note: instantiated into assembly here</div>
<div>        movq (%rax, %ebx, 4), %mm0</div><div>              ^~~~~</div><div><br></div></div><div>Please review.</div></div>