[llvm-dev] [LLVMdev] Wrong encoding/decoding for POPC instruction of Sparc
David Wiberg via llvm-dev
llvm-dev at lists.llvm.org
Sat Aug 8 01:53:28 PDT 2015
Hi,
James made some improvements and committed it in r244064.
Best regards
David
2015-08-08 4:08 GMT+02:00 Jun Koi <junkoi2004 at gmail.com>:
> James, is the fix of David accepted?
>
> Thanks.
>
>
>
> On Fri, Jul 31, 2015 at 10:02 AM, David Wiberg <dwiberg at gmail.com> wrote:
>>
>> Hi James,
>>
>> 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.
>>
>> 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.
>>
>> Regards
>> David
>>
>> 2015-07-31 16:56 GMT+02:00 James Y Knight <jyknight at google.com>:
>>>
>>> I'll look into it, thanks for the report.
>>>
>>> On Thu, Jul 30, 2015 at 11:01 PM, Jun Koi <junkoi2004 at gmail.com> wrote:
>>>>
>>>> Any ideas on this bug?
>>>>
>>>> Thanks.
>>>>
>>>>
>>>> On Wed, Jul 29, 2015 at 12:17 AM, Jun Koi <junkoi2004 at gmail.com> wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> There is an issue in the latest Sparc code: while we can encode POPC,
>>>>> decode results in crash in llvm-mc
>>>>>
>>>>> $ echo "popc %g1, %g2" | ./Release+Asserts/bin/llvm-mc -assemble
>>>>> -triple=sparcv9 -show-encoding
>>>>> .text
>>>>> popc %g1, %g2 ! encoding: [0x85,0x70,0x00,0x01]
>>>>>
>>>>> $ echo "0x85,0x70,0x00,0x01"|./Release+Asserts/bin/llvm-mc -disassemble
>>>>> -triple=sparcv9
>>>>> .text
>>>>> popc Assertion failed: (idx < size()), function operator[], file
>>>>> /Users/jun/projects/llvm/sparc-2.git/include/llvm/ADT/SmallVector.h, line
>>>>> 143.
>>>>> 0 llvm-mc 0x00000001096a5099
>>>>> llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 57
>>>>> 1 llvm-mc 0x00000001096a45c6
>>>>> llvm::sys::RunSignalHandlers() + 102
>>>>> 2 llvm-mc 0x00000001096a5b95 SignalHandler(int) + 693
>>>>> 3 libsystem_platform.dylib 0x00007fff86d78f1a _sigtramp + 26
>>>>> 4 libsystem_platform.dylib 0x0000000000000002 _sigtramp + 2032693506
>>>>> 5 llvm-mc 0x00000001096a5836 abort + 22
>>>>> 6 llvm-mc 0x00000001096a5811 __assert_rtn + 81
>>>>> 7 llvm-mc 0x000000010963f4e8
>>>>> llvm::SparcInstPrinter::printOperand(llvm::MCInst const*, int,
>>>>> llvm::MCSubtargetInfo const&, llvm::raw_ostream&) + 136
>>>>> 8 llvm-mc 0x000000010963eae0
>>>>> llvm::SparcInstPrinter::printInstruction(llvm::MCInst const*,
>>>>> llvm::MCSubtargetInfo const&, llvm::raw_ostream&) + 256
>>>>> 9 llvm-mc 0x000000010964f5e6
>>>>> llvm::SparcInstPrinter::printInst(llvm::MCInst const*, llvm::raw_ostream&,
>>>>> llvm::StringRef, llvm::MCSubtargetInfo const&) + 86
>>>>> 10 llvm-mc 0x000000010965f90f (anonymous
>>>>> namespace)::MCAsmStreamer::EmitInstruction(llvm::MCInst const&,
>>>>> llvm::MCSubtargetInfo const&) + 2879
>>>>> 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
>>>>> 12 llvm-mc 0x0000000109607460 main + 9760
>>>>> 13 libdyld.dylib 0x00007fff8f34d5c9 start + 1
>>>>> 14 libdyld.dylib 0x0000000000000003 start + 1892362811
>>>>> Stack dump:
>>>>> 0. Program arguments: ./Release+Asserts/bin/llvm-mc -disassemble
>>>>> -triple=sparcv9
>>>>> Illegal instruction: 4
>>>>>
>>>>>
>>>>> Any ideas on what is wrong, and how to fix this?
>>>>>
>>>>>
>>>>> Thank you.
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> LLVM Developers mailing list
>>>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>>
>>>
>>>
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>
>>
>
More information about the llvm-dev
mailing list