[LLVMdev] Extended Inline asm with double data type crashes clang

Eli Friedman eli.friedman at gmail.com
Thu Nov 22 13:01:07 PST 2012


On Thu, Nov 22, 2012 at 4:14 AM, rajesh viswabramana
<viswabramana.rajesh at gmail.com> wrote:
> Hi all,
>
> I tried same code on gcc for arm(hard float),
>
> double f2 ()
> {
> double x = 10.0;
>
> asm ("" : "=r" (x) : "0" (x));
> return x;
> }
>
>> arm-linux-gnueabi-gcc -S -mhard-float pr39058.c -O2
>
> Generates proper code,
>     mov    r3, #0
>     mov    r2, #0
>     movt    r3, 16420
>     fmdrr    d0, r2, r3
>     bx    lr
>
> But llvm crashes, If data type is "double", register type is "int".
> Any comments why does llvm currently handle this case ?

"r" is supposed to be a single register, not a register pair; the fact
that gcc accepts this is probably an accident.  clang should reject
this code (without crashing, of course).

-Eli



More information about the llvm-dev mailing list