<div dir="ltr"><div><div><div><div>Hi James,<br><br></div>Not sure if you've already found the 
problem but I've been looking at this issue a bit as a way to learn. What I've seen is that the wrong operand names are used for the instruction which 
causes the decoder emitter to fail to recognize the operands.<br><br></div>The attached patch changes the names of the operands and adds a test for the disassembly of the instruction. I haven't checked if there are more instructions which lack test cases. I have no commit access, if you think the patch is correct I would appreciate your help in committing it.<br><br></div>Regards<br></div>David<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-07-31 16:56 GMT+02:00 James Y Knight <span dir="ltr"><<a href="mailto:jyknight@google.com" target="_blank">jyknight@google.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'll look into it, thanks for the report.</div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Thu, Jul 30, 2015 at 11:01 PM, Jun Koi <span dir="ltr"><<a href="mailto:junkoi2004@gmail.com" target="_blank">junkoi2004@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>Any ideas on this bug?<br><br></div>Thanks.<br><br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 29, 2015 at 12:17 AM, Jun Koi <span dir="ltr"><<a href="mailto:junkoi2004@gmail.com" target="_blank">junkoi2004@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hello,<br><br>There is an issue in the latest Sparc code: while we can encode 
POPC, decode results in crash in llvm-mc<br><br>$ echo "popc %g1, %g2" | ./Release+Asserts/bin/llvm-mc -assemble -triple=sparcv9 -show-encoding<br>    .text<br>    popc %g1, %g2                   ! encoding: [0x85,0x70,0x00,0x01]<br><br>$ echo "0x85,0x70,0x00,0x01"|./Release+Asserts/bin/llvm-mc -disassemble -triple=sparcv9<br>    .text<br>    popc Assertion failed: (idx < size()), function operator[], file /Users/jun/projects/llvm/sparc-2.git/include/llvm/ADT/SmallVector.h, line 143.<br>0  llvm-mc                  0x00000001096a5099 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 57<br>1  llvm-mc                  0x00000001096a45c6 llvm::sys::RunSignalHandlers() + 102<br>2  llvm-mc                  0x00000001096a5b95 SignalHandler(int) + 693<br>3  libsystem_platform.dylib 0x00007fff86d78f1a _sigtramp + 26<br>4  libsystem_platform.dylib 0x0000000000000002 _sigtramp <a href="tel:%2B%202032693506" value="+2032693506" target="_blank">+ 2032693506</a><br>5  llvm-mc                  0x00000001096a5836 abort + 22<br>6  llvm-mc                  0x00000001096a5811 __assert_rtn + 81<br>7  llvm-mc                  0x000000010963f4e8 llvm::SparcInstPrinter::printOperand(llvm::MCInst const*, int, llvm::MCSubtargetInfo const&, llvm::raw_ostream&) + 136<br>8  llvm-mc                  0x000000010963eae0 llvm::SparcInstPrinter::printInstruction(llvm::MCInst const*, llvm::MCSubtargetInfo const&, llvm::raw_ostream&) + 256<br>9  llvm-mc                  0x000000010964f5e6 llvm::SparcInstPrinter::printInst(llvm::MCInst const*, llvm::raw_ostream&, llvm::StringRef, llvm::MCSubtargetInfo const&) + 86<br>10 llvm-mc                  0x000000010965f90f (anonymous namespace)::MCAsmStreamer::EmitInstruction(llvm::MCInst const&, llvm::MCSubtargetInfo const&) + 2879<br>11 llvm-mc                  0x00000001096043b3 llvm::Disassembler::disassemble(llvm::Target
 const&, std::__1::basic_string<char, 
std::__1::char_traits<char>, std::__1::allocator<char> > 
const&, llvm::MCSubtargetInfo&, llvm::MCStreamer&, 
llvm::MemoryBuffer&, llvm::SourceMgr&, llvm::raw_ostream&) +
 2147<br>12 llvm-mc                  0x0000000109607460 main + 9760<br>13 libdyld.dylib            0x00007fff8f34d5c9 start + 1<br>14 libdyld.dylib            0x0000000000000003 start + 1892362811<span><br>Stack dump:<br>0.    Program arguments: ./Release+Asserts/bin/llvm-mc -disassemble -triple=sparcv9 <br>Illegal instruction: 4<br><br><br></span>Any ideas on what is wrong, and how to fix this?<br><br><br></div>Thank you.<br></div>
</blockquote></div><br></div>
</div></div><br></div></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" rel="noreferrer" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" rel="noreferrer" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>