[LLVMdev] inline asm question

Richard Pennington rich at pennware.com
Sun Aug 2 19:43:00 PDT 2009


Eli Friedman wrote:
> 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
Eli,

Thanks for the clarification and link.  It makes sense now.

-Rich



More information about the llvm-dev mailing list