[llvm-dev] IR inline assembly: the x86 Intel "offset" operator

Reid Kleckner via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 10 16:23:19 PST 2019


I think perhaps we want to make this LLVM IR asm string:
  call void asm sideeffect inteldialect "mov eax, $0",
"i,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* @"?Bar@@3HA") #1, !srcloc !3

The key thing is the 'i' constraint. That ends up producing the wrong
assembly right now, but maybe with your rebased patch, now it will do the
right thing.

If you change up the dialect and switch to an ELF triple, this inline asm
will produce the expected instruction sequence:
  call void asm sideeffect "movl $0, %eax",
"i,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* @"?Bar@@3HA") #1, !srcloc !3
Which is what makes me think this is the way to go.

It's consistent with the AOK_Skip rewrite we do today to skip the "offset"
text.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191210/cce14f3f/attachment.html>


More information about the llvm-dev mailing list