[llvm-dev] Bug or incorrect use of inline asm?
Johan Engelen via llvm-dev
llvm-dev at lists.llvm.org
Thu Aug 3 08:58:25 PDT 2017
Hi all,
I stumbled upon either a bug, or we are emitting wrong inline asm code.
The testcase is:
```
source_filename = "testcase.d"
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx"
define void @_D7asanasm3fooFZv() {
%a = alloca [4 x i32], align 32
call void asm sideeffect "movl %ebx, 4+$0", "=*m,~{memory}"([4 x i32]* %a)
ret void
}
```
When I try to compile this to assembly code with llc, llc errors.
> llc testcase.ll -o testcase.s -O0
<inline asm>:1:16: error: unknown token in expression
movl %ebx, 4+(%rsp)
^
The explicit `-O0` is required for the error to arise.
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 ".
Is this a bug in the asm parser?
Thanks,
Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170803/122595df/attachment.html>
More information about the llvm-dev
mailing list