[llvm-dev] Bug or incorrect use of inline asm?

Eric Christopher via llvm-dev llvm-dev at lists.llvm.org
Fri Aug 4 14:35:27 PDT 2017


On Thu, Aug 3, 2017 at 9:19 AM Tim Northover via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> 2017-08-03 8:58 GMT-07:00 Johan Engelen via llvm-dev <
> llvm-dev at lists.llvm.org>:
> > The error is gone after removing (or reducing) the alignment of `%a`.
> This
> > makes me believe that our inline asm syntax is correct to add an offset
> to a
> > pointer: " 4+$0 ".
>
> The AT&T syntax for a displaced address doesn't have the '+'; it's
> just "4(%rsp)" so you should change the IR to "4$0".
>
> LLVM appears to be optimizing the addressing mode, and the optimizer
> is being more lenient on this detail so you're getting lucky when the
> +4 can be combined with an existing %rsp offset.
>
>
FWIW we do support:

4+4(%rsp)

as 8(%rsp)

we just don't support

4+(%rsp)

but do support

4+0(%rsp)

as 4(%rsp)

oddly enough gas does support the 4+(%rsp) but I've never had time to go
try to fix it in the assembler.

-eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170804/83aae4d7/attachment.html>


More information about the llvm-dev mailing list