rajesh viswabramana
2012-Nov-21 09:49 UTC
[LLVMdev] Extended Inline asm with double data type crashes clang
Thanks Rafael, Hello All, Could anyone please comment, which part in selectiondag need to be understood/modified to fix this. Regards, Rajesh On Wed, Nov 21, 2012 at 2:38 AM, Rafael EspĂndola < rafael.espindola at gmail.com> wrote:> I reported llvm.org/pr14393 to track it. > > On 20 November 2012 05:18, rajesh viswabramana > <viswabramana.rajesh at gmail.com> wrote: > > Hi, > > > > Clang crashes when below snippet of code is compiled (used latest svn > > version) > > > > double func1() > > { > > double x ; > > asm ( "" : "=r"(x) : "0"(x) ); > > return x; > > } > > > >> clang -S test1.c > >> Assertion failed: (PartVT.isInteger() || PartVT == MVT::x86mmx) && > >> ValueVT.isInteger() && "Unknown mismatch!", file > >> ..\..\..\..\lib\CodeGen\SelectionDAG\SelectionDAGBuilder.cpp, line 378 > > > > > > Compilation sucessful, If data type passed to inline asm is of float > > float x ; > > asm ( "" : "=r"(x) : "0"(x) ); > > > > (or) If double data type passed to float type of registers > > double x; > > asm ( "" : "=t"(x) : "0"(x) ); > > > > It seems currently LLVM (selectionDAG) doesn't handle double to general > > purpose register storing. > > Could anyone please comment on this. > > > > Regards, > > Rajesh > > > > > > > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu llvm.cs.uiuc.edu > > lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <lists.llvm.org/pipermail/llvm-dev/attachments/20121121/4ebb7b1e/attachment.html>
rajesh viswabramana
2012-Nov-22 12:14 UTC
[LLVMdev] Extended Inline asm with double data type crashes clang
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 -O2Generates 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 ? Regards, Rajesh On Wed, Nov 21, 2012 at 3:19 PM, rajesh viswabramana < viswabramana.rajesh at gmail.com> wrote:> Thanks Rafael, > > Hello All, > > Could anyone please comment, which part in selectiondag need to be > understood/modified to fix this. > > Regards, > Rajesh > > > > > On Wed, Nov 21, 2012 at 2:38 AM, Rafael EspĂndola < > rafael.espindola at gmail.com> wrote: > >> I reported llvm.org/pr14393 to track it. >> >> On 20 November 2012 05:18, rajesh viswabramana >> <viswabramana.rajesh at gmail.com> wrote: >> > Hi, >> > >> > Clang crashes when below snippet of code is compiled (used latest svn >> > version) >> > >> > double func1() >> > { >> > double x ; >> > asm ( "" : "=r"(x) : "0"(x) ); >> > return x; >> > } >> > >> >> clang -S test1.c >> >> Assertion failed: (PartVT.isInteger() || PartVT == MVT::x86mmx) && >> >> ValueVT.isInteger() && "Unknown mismatch!", file >> >> ..\..\..\..\lib\CodeGen\SelectionDAG\SelectionDAGBuilder.cpp, line 378 >> > >> > >> > Compilation sucessful, If data type passed to inline asm is of float >> > float x ; >> > asm ( "" : "=r"(x) : "0"(x) ); >> > >> > (or) If double data type passed to float type of registers >> > double x; >> > asm ( "" : "=t"(x) : "0"(x) ); >> > >> > It seems currently LLVM (selectionDAG) doesn't handle double to general >> > purpose register storing. >> > Could anyone please comment on this. >> > >> > Regards, >> > Rajesh >> > >> > >> > >> > _______________________________________________ >> > LLVM Developers mailing list >> > LLVMdev at cs.uiuc.edu llvm.cs.uiuc.edu >> > lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> > >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <lists.llvm.org/pipermail/llvm-dev/attachments/20121122/d8086c67/attachment.html>
Eli Friedman
2012-Nov-22 21:01 UTC
[LLVMdev] Extended Inline asm with double data type crashes clang
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
Reasonably Related Threads
- [LLVMdev] Extended Inline asm with double data type crashes clang
- [LLVMdev] Extended Inline asm with double data type crashes clang
- [LLVMdev] Extended Inline asm with double data type crashes clang
- [LLVMdev] Extended Inline asm with double data type crashes clang
- [LLVMdev] Function inline causes crash in clang for .ast to .s