<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>Hi Tim,<br/>
<br/>
x2 is automatically used as input for the asm block. Also as caller-saved argument register shouldn't it be "clobbered" anyway?<br/>
<br/>
On 03.10.2016 22:14, Tim Northover wrote:
<blockquote type="cite">Hi Alex,<br/>
<br/>
On 30 September 2016 at 07:13, via cfe-dev <a href="mailto:cfe-dev@lists.llvm.org"><cfe-dev@lists.llvm.org></a> wrote:

<blockquote type="cite">I would expect the x2 argument register to be saved and restored when used<br/>
beyond an asm block. The movs between x2 and x19 oddly seem to be in the<br/>
wrong direction. Register x19 is later used with  an unexpected value and<br/>
the program segfaults.  Is this a bug or the expected behaviour? The<br/>
architecture is aarch64.</blockquote>
Nothing in the snippet you posted clobbers x2 so I'd expect that to be<br/>
valid code. If your inline asm block makes actual function calls then<br/>
it needs to mark the registers that don't get preserved as clobbered.<br/>
LLVM won't inspect the string looking for a function call or infer its<br/>
ABI.<br/>
<br/>
Cheers.<br/>
<br/>
Tim.</blockquote>
</div></div></body></html>