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

Eric Astor via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 11 12:47:45 PST 2019


That did it: issue was in X86AsmPrinter::PrintOperand, which emitted a
prefix of "$" when printing an address operand in AT&T syntax... but didn't
add the prefix "offset " when in Intel syntax.

Still need to get clang to emit the operand with the "i" constraint, but
now at least I know what success will look like.

On Wed, Dec 11, 2019 at 2:32 PM Reid Kleckner <rnk at google.com> wrote:

> On Wed, Dec 11, 2019 at 9:45 AM Eric Astor <epastor at google.com> wrote:
>
>> Interesting - the patch doesn't address this yet. It looks like we have a
>> difference (maybe bug?) in how we handle Intel vs. AT&T inline assembly:
>> https://godbolt.org/z/GQw9ED
>>
>> Suppose we're expanding an operand with an 'i' constraint, where the
>> operand is given as, e.g. (i32* @Bar).
>> If the inline assembly is in Intel dialect, this expands as "Bar" in AT&T
>> syntax or "dword ptr [Bar]" in Intel syntax.
>> If the inline assembly is in AT&T dialect, it expands as "$Bar" in AT&T
>> syntax or "offset Bar" in Intel syntax.
>>
>
> That sounds right.
>
>
>> I'd like to try to reconcile this, but I haven't been able to track down
>> where inline-assembly operands are expanded yet... anyone know where I
>> should be looking?
>>
>
> I'm pretty sure this is
> llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp.
>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191211/0a0de9d7/attachment.html>


More information about the llvm-dev mailing list