[LLVMdev] inline asm question

Eli Friedman eli.friedman at gmail.com
Sun Aug 2 18:41:13 PDT 2009


2009/8/2 Richard Pennington <rich at pennware.com>:
> Eli Friedman wrote:
>> 2009/8/2 Richard Pennington <rich at pennware.com>:
>>> The following fails on x86_64 because of the output constraint '0'.
>>> My question is, is this legal. LLVM complains about the size difference
>>> (32 vs 64), but it is the same register (ax).
>>> Works on x86.
>>>
>>> %42 = call i64 asm sideeffect "syscall\0A\09",
>>> "={ax},0,{di},~{dirflag},~{fpsr},~{flags}"(i64 231, i64 %41) nounwind
>>>          ; <i64> [#uses=2]
>>>
>>> -Rich
>>
>> Can you give a complete testcase?  Running the following through
>> "llvm-as | llc -march=x86-64" works just fine:
>> define void @a() {
>> call i64 asm sideeffect "syscall\0A\09",
>> "={ax},0,{di},~{dirflag},~{fpsr},~{flags}"(i64 231, i64 123) nounwind
>> ret void
>> }
>
> Sorry Eli, I copied from a version that I got to pass.
> The original was
> call i64 asm sideeffect "syscall\0A\09",
> "={ax},0,{di},~{dirflag},~{fpsr},~{flags}"(i32 231, i64 123) nounwind
> ret void}
>
> The return value(in ax) is i64. The first input arg (in ax) is i32.
>
> Not sure how to deal with that,

We've decided that this is invalid; if the front-end wants to deal
with such constructs, it's supposed to deal with them itself.  See
http://llvm.org/bugs/show_bug.cgi?id=3373.

-Eli




More information about the llvm-dev mailing list