[cfe-dev] Clang rejects inline assembly that has tied operands with different types

Daniel Sanders Daniel.Sanders at imgtec.com
Thu Feb 5 03:26:31 PST 2015


> I’m not sure whether this restriction should be relaxed to allow operands with different size or it’s the
> source program that has to be fixed. I couldn’t find anything in gcc’s documentation that says whether
> or not this is legal.

I'm not sure either. I have some candidate patches to the source program and changing the source is my preference because there's only a single instance of this construct as far as I know. However it also makes sense to be able to do something like:
    int result;
    short operand;
    asm  ("seh %0, %1" : "=r"(result) : "0"(operand)) // seh is a sign-extend instruction
as long as an int and a short can be stored in the same register.

From: Akira Hatanaka [mailto:ahatanaka at apple.com]
Sent: 04 February 2015 19:15
To: Reid Kleckner
Cc: Daniel Sanders; cfe-dev at cs.uiuc.edu
Subject: Re: [cfe-dev] Clang rejects inline assembly that has tied operands with different types

I changed this function recently (yesterday), but I think this error message is unrelated to the change I made. The piece of code that emits this error was committed originally in r70142.
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090420/016312.html

I’m not sure whether this restriction should be relaxed to allow operands with different size or it’s the source program that has to be fixed. I couldn’t find anything in gcc’s documentation that says whether or not this is legal.

https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Extended-Asm

On Feb 4, 2015, at 10:25 AM, Reid Kleckner <rnk at google.com<mailto:rnk at google.com>> wrote:

csum_ipv6_magic

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150205/90e482c4/attachment.html>


More information about the cfe-dev mailing list