[LLVMdev] Question on Inline Assembly Code generation for X64

Tae Jun Ham ham.taejun at gmail.com
Fri Mar 20 23:37:57 PDT 2015


I have a question on inline assembly code generation for X64. 

I have following LLVM IR : 

%c = fsub fast float %a, %b
 tail call void asm sideeffect "mov $0, %eax \0A\09  movd $1, %xmm0 \0A\09  xchg %dx, %dx\0A", "ir,r,~{ax}"(i32 100, float %c) 

The assembly that I get for this part of the code is as follows (x64 target). 
*xchgw %dx, %dx is a nop that I am using to do some stuff in binary translator. 

subss	%xmm1, %xmm0
movd	%xmm0, %edi
movl	$25, %eax
movd	%edi, %xmm0
xchgw	%dx, %dx
What I wanted/expected was following : 

subss	%xmm1, %xmm0
movl	$25, %eax
movd	%xmm0, %xmm0
xchgw	%dx, %dx

What would be the proper way to get the output I want ? 

Thank you
Tae Jun Ham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150321/2ee796f0/attachment.html>

More information about the llvm-dev mailing list