<div dir="ltr"><span style="color:rgb(0,0,0);font-size:12.8px">Dear Developers,</span><div><span style="color:rgb(0,0,0);font-size:12.8px"><br></span></div><div><span style="color:rgb(0,0,0);font-size:12.8px">I found out the information included in the last mail is incorrect. Sorry for misleading stack dump information. That information is generated when AMDGPUAsmParser parsing the following assembly: </span></div><div><span style="color:rgb(0,0,0);font-size:12.8px"><br></span></div><div><span style="color:rgb(0,0,0);font-size:12.8px">v_mad_f32 v9, 0.5, v5, -v8</span><span style="color:rgb(0,0,0);font-size:12.8px"><br></span></div><div><span style="color:rgb(0,0,0);font-size:12.8px"><br></span></div><div><div><font color="#000000"><span style="font-size:12.8px">llvm-mc: /mnt/dm-0/codebase/Compilers/LLVM/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp:184: void (anonymous namespace)::AMDGPUOperand::setModifiers(unsigned int): Assertion `isReg()' failed.</span></font></div><div><font color="#000000"><span style="font-size:12.8px">#0 0x6608ee llvm::sys::PrintStackTrace(llvm::raw_ostream&) /mnt/dm-0/codebase/Compilers/LLVM/llvm/lib/Support/Unix/Signals.inc:404:15</span></font></div><div><font color="#000000"><span style="font-size:12.8px">#1 0x661a29 PrintStackTraceSignalHandler(void*) /mnt/dm-0/codebase/Compilers/LLVM/llvm/lib/Support/Unix/Signals.inc:463:1</span></font></div><div><font color="#000000"><span style="font-size:12.8px">#2 0x660463 llvm::sys::RunSignalHandlers() /mnt/dm-0/codebase/Compilers/LLVM/llvm/lib/Support/Signals.cpp:35:5</span></font></div><div><font color="#000000"><span style="font-size:12.8px">#3 0x661c84 SignalHandler(int) /mnt/dm-0/codebase/Compilers/LLVM/llvm/lib/Support/Unix/Signals.inc:211:1</span></font></div><div><font color="#000000"><span style="font-size:12.8px">#4 0x7fb282371d60 __restore_rt (/usr/lib/libpthread.so.0+0x10d60)</span></font></div><div><font color="#000000"><span style="font-size:12.8px">#5 0x7fb2815445f8 __GI_raise (/usr/lib/libc.so.6+0x335f8)</span></font></div><div><font color="#000000"><span style="font-size:12.8px">#6 0x7fb281545a7a __GI_abort (/usr/lib/libc.so.6+0x34a7a)</span></font></div><div><font color="#000000"><span style="font-size:12.8px">#7 0x7fb28153d417 __assert_fail_base (/usr/lib/libc.so.6+0x2c417)</span></font></div><div><font color="#000000"><span style="font-size:12.8px">#8 0x7fb28153d4c2 (/usr/lib/libc.so.6+0x2c4c2)</span></font></div><div><font color="#000000"><span style="font-size:12.8px">#9 0x4711ee (anonymous namespace)::AMDGPUOperand::setModifiers(unsigned int) /mnt/dm-0/codebase/Compilers/LLVM/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp:185:21</span></font></div><div><font color="#000000"><span style="font-size:12.8px">#10 0x46ff6a (anonymous namespace)::AMDGPUAsmParser::parseOperand(llvm::SmallVectorImpl<std::unique_ptr<llvm::MCParsedAsmOperand, std::default_delete<llvm::MCParsedAsmOperand> > >&, llvm::StringRef) /mnt/dm-0/codebase/Compilers/LLVM/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp:1040:16</span></font></div><div><font color="#000000"><span style="font-size:12.8px">#11 0x46cd46 (anonymous namespace)::AMDGPUAsmParser::ParseInstruction(llvm::ParseInstructionInfo&, llvm::StringRef, llvm::SMLoc, llvm::SmallVectorImpl<std::unique_ptr<llvm::MCParsedAsmOperand, std::default_delete<llvm::MCParsedAsmOperand> > >&) /mnt/dm-0/codebase/Compilers/LLVM/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp:1085:43</span></font></div><div><font color="#000000"><span style="font-size:12.8px">#12 0x5ae9a7 (anonymous namespace)::AsmParser::parseStatement((anonymous namespace)::ParseStatementInfo&, llvm::MCAsmParserSemaCallback*) /mnt/dm-0/codebase/Compilers/LLVM/llvm/lib/MC/MCParser/AsmParser.cpp:1620:8</span></font></div><div><font color="#000000"><span style="font-size:12.8px">#13 0x5a4d76 (anonymous namespace)::AsmParser::Run(bool, bool) /mnt/dm-0/codebase/Compilers/LLVM/llvm/lib/MC/MCParser/AsmParser.cpp:654:9</span></font></div><div><font color="#000000"><span style="font-size:12.8px">#14 0x41274c AssembleInput(char const*, llvm::Target const*, llvm::SourceMgr&, llvm::MCContext&, llvm::MCStreamer&, llvm::MCAsmInfo&, llvm::MCSubtargetInfo&, llvm::MCInstrInfo&, llvm::MCTargetOptions&) /mnt/dm-0/codebase/Compilers/LLVM/llvm/tools/llvm-mc/llvm-mc.cpp:363:13</span></font></div><div><font color="#000000"><span style="font-size:12.8px">#15 0x41165a main /mnt/dm-0/codebase/Compilers/LLVM/llvm/tools/llvm-mc/llvm-mc.cpp:527:9</span></font></div><div><font color="#000000"><span style="font-size:12.8px">#16 0x7fb281531610 __libc_start_main (/usr/lib/libc.so.6+0x20610)</span></font></div><div><font color="#000000"><span style="font-size:12.8px">#17 0x410009 _start (/usr/local/bin/llvm-mc+0x410009)</span></font></div><div><font color="#000000"><span style="font-size:12.8px">Stack dump:</span></font></div><div><font color="#000000"><span style="font-size:12.8px">0.<span class="" style="white-space:pre">       </span>Program arguments: llvm-mc -arch=amdgcn -mcpu=SI sop1-playground.s </span></font></div><div><font color="#000000"><span style="font-size:12.8px">zsh: abort (core dumped)  llvm-mc -arch=amdgcn -mcpu=SI sop1-playground.s</span></font></div></div><div><br></div><div><span style="color:rgb(0,0,0);font-size:12.8px">When the assembly code is </span><span style="color:rgb(0,0,0);font-size:12.8px">s_mov_b32 s0, 0xfe5163ab, the error message is the following (and the program terminates without the assertion failed)</span></div><div><span style="color:rgb(0,0,0);font-size:12.8px"><br></span></div><div style="color:rgb(0,0,0);font-size:12.8px"><span style="font-size:12.8px">sop1-playground.s:1:15: error: invalid immediate: only 32-bit values are legal</span><br></div><div style="color:rgb(0,0,0);font-size:12.8px"><div>s_mov_b32 s0, 0xfe5163ab</div><div>                       ^</div><div>sop1-playground.s:1:25: error: failed parsing operand.</div><div>s_mov_b32 s0, 0xfe5163ab</div></div><div><span style="color:rgb(0,0,0);font-size:12.8px">                                       ^</span><span style="color:rgb(0,0,0);font-size:12.8px"> </span></div><div><span style="color:rgb(0,0,0);font-size:12.8px"><br></span></div><div><div style="color:rgb(0,0,0);font-size:12.8px">Regards,</div><div style="color:rgb(0,0,0);font-size:12.8px"><br></div><div style="color:rgb(0,0,0);font-size:12.8px"><div style="font-size:12.8px">李弘宇 (Li, Hong-Yu)</div><div style="font-size:12.8px">Department of Computer Science & Information Engineering</div><div style="font-size:12.8px">National Taiwan University</div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 23, 2015 at 3:36 PM, 李弘宇 <span dir="ltr"><<a href="mailto:zhenlinospirit@gmail.com" target="_blank">zhenlinospirit@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">Dear Developers,<div><br></div><div>I compile a OpenCL kernel, FFT, in AMDAPP SDK v2.5 using clang 3.8 + libclc and assembling the code with lld (The LLVM linker). The assembly code contains the following assembly codes (and lots of other similar format assembly) that fails to be parsed by AMDGPUAsmParser. It seems to me that both are valid instructions after looking at the SI instruction spec.</div><div><br></div><div>s_mov_b32 s0, 0xfe5163ab<br></div><div>v_mad_f32 v9, 0.5, v5, -v8<br></div><div><br></div><div>To reproduce this, I write this two lines in a text file and run</div><div><br></div><div>llvm-mc -arch=amdgcn -mcpu=kaveri input.s</div><div><br></div><div>The first line has the following error message:</div><div><br></div><div><div>sop1-playground.s:1:15: error: invalid immediate: only 32-bit values are legal</div><div>s_mov_b32 s0, 0xfe5163ab</div><div>                         ^</div><div>sop1-playground.s:1:25: error: failed parsing operand.</div><div>s_mov_b32 s0, 0xfe5163ab</div><div>                                            ^</div></div><div>The part of stack dump:</div><div><br></div><div>...</div><div><div>#9 0x4711ee (anonymous namespace)::AMDGPUOperand::setModifiers(unsigned int) /mnt/dm-0/codebase/Compilers/LLVM/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp:185:21</div><div>#10 0x46ff6a (anonymous namespace)::AMDGPUAsmParser::parseOperand(llvm::SmallVectorImpl<std::unique_ptr<llvm::MCParsedAsmOperand, std::default_delete<llvm::MCParsedAsmOperand> > >&, llvm::StringRef) /mnt/dm-0/codebase/Compilers/LLVM/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp:1040:16</div><div>#11 0x46cd46 (anonymous namespace)::AMDGPUAsmParser::ParseInstruction(llvm::ParseInstructionInfo&, llvm::StringRef, llvm::SMLoc, llvm::SmallVectorImpl<std::unique_ptr<llvm::MCParsedAsmOperand, std::default_delete<llvm::MCParsedAsmOperand> > >&) /mnt/dm-0/codebase/Compilers/LLVM/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp:1085:43</div></div><div>...</div><div><br></div><div>The second line of the assembly has the assertion fail:</div><div><br></div><div>llvm-mc: /mnt/dm-0/codebase/Compilers/LLVM/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp:184: void (anonymous namespace)::AMDGPUOperand::setModifiers(unsigned int): Assertion `isReg()' failed.<br></div><div><br></div><div>and reports that 0.5 is "error: invalid operand for instruction"</div><div><br></div><div>v_mad_f32 v9, 0.5, v5, -v8<br></div><div>                         ^<br></div><div><br></div><div>Regards,</div><div><br></div><div><div><div style="color:rgb(0,0,0);font-size:12.8px"><span>李弘宇</span> (Li, Hong-Yu)</div><div style="color:rgb(0,0,0);font-size:12.8px">Department of Computer Science & Information Engineering</div><div style="color:rgb(0,0,0);font-size:12.8px">National Taiwan University</div></div></div></div>
</blockquote></div><br></div>