<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<style>
font{
line-height: 1.6;
}
ul,ol{
padding-left: 20px;
list-style-position: inside;
}
</style>
<div style="font-family:微软雅黑,Verdana,"Microsoft Yahei",SimSun,sans-serif; line-height:1.6;">
<div>Hi,every one.</div><div>I' in trouble again.</div><div>I want add a new intrinsic mapping a new instruction.</div><div><br></div><div><span style="line-height: 1.6;">I add the int_x86_max_qb as fllowing:</span></div><div><span style="line-height: 1.6;">def int_x86_max_qb: GCCBuiltin<</span><span class="hljs-string" style="line-height: 1.6;">"__builtin_x86_max_qb"</span><span style="line-height: 1.6;">>, </span><span style="line-height: 1.6;">Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [Commutative]>;</span></div><div><span style="line-height: 1.6;"><br></span></div><div><span style="line-height: 1.6;"><div>BUILTIN(__builtin_x86_max_qb, "iii", "") </div><div><br></div><div><span style="line-height: 22.4px;">I define the </span><span style="line-height: 22.4px;">intrinsic as </span><span style="line-height: 1.6;">Pseudo instruction,it succeed.</span></div><div><span style="line-height: 1.6;"><br></span></div><div><span style="line-height: 1.6;">But when mapping a new </span><span style="line-height: 22.4px;">instruction.I don't know how to do.</span></div><div><span style="line-height: 22.4px;">In x86InstrArithmetic.td. I add ,(To </span><span style="line-height: 1.6;">make sure the </span><span style="line-height: 22.4px;">Sched </span><span style="line-height: 1.6;">is right, I use the </span><span style="line-height: 22.4px;">WriteIMul16Reg</span><span style="line-height: 1.6;"> </span><span style="line-height: 22.4px;">)</span></div></span><div><div style="line-height: 1.6;">def max_qb : I<0xF0,MRMSrcReg, (outs GR32:$dst), (ins GR32:$src1,GR32:$src2),<span style="line-height: 1.6;"> "max_qb\t {$dst, $src1,$src2}", [(set GR32:$dst,(X86max_qb GR32:$src1, GR32:$src2))]>,Sched<[WriteIMul16Reg]>,</span><span style="line-height: 1.6;">OpSize32 ;</span></div><div style="line-height: 1.6;"><span style="line-height: 1.6;">when </span><span id="result_box" class="short_text" lang="en">compile </span><span style="line-height: 1.6;">LLVM , the error appears.</span></div><div style="line-height: 1.6;"><span style="line-height: 1.6;">"</span><span style="line-height: 1.6;">[ 97%] Updating X86GenAsmWriter1.inc... </span></div><div style="line-height: 1.6;"><span style="line-height: 1.6;">Unhandled immediate encoding GR32</span></div><div style="line-height: 1.6;">Unhandled immediate encoding</div><div style="line-height: 1.6;"><span style="line-height: 1.6;">"</span></div><div style="line-height: 1.6;"><span style="line-height: 1.6;"><br></span></div><div style=""><span style="line-height: 1.6;">But when I write the same as the </span><span style="line-height: 22.4px;">instruction</span><span style="line-height: 1.6;"> </span><span style="line-height: 1.6;">IMUL32rr, there is no error in </span><span style="line-height: 22.4px;">compiling.(I don't use the </span><span style="line-height: 22.4px;">EFLAGS at all, so I think it's wrong. I</span><span style="line-height: 1.6;">ndeed, it made a error when using it.</span><span style="line-height: 22.4px;">)</span></div><div style="">let Defs = [EFLAGS] in {</div><div style=""><div>let Constraints = "$src1 = $dst" in {</div><div>let isCommutable = 1 in {</div></div></div><span style="line-height: 1.6;"><div><span style="line-height: 22.4px;">def max_qb : I<0xF0,MRMSrcReg, (outs GR32:$dst), (ins GR32:$src1,GR32:$src2),</span><span style="line-height: 1.6;"> "max_qb\t {$dst, $src1,$src2}", [(set GR32:$dst,(X86max_qb GR32:$src1, GR32:$src2))]>,Sched<[WriteIMul16Reg]>,</span><span style="line-height: 1.6;">OpSize32 ;</span></div><div><span style="line-height: 1.6;">}</span></div><div><span style="line-height: 1.6;">}</span></div><div><span style="line-height: 1.6;"><br></span></div><div><span style="line-height: 1.6;">What I don't understand is that how I define "let in ".</span></div><div><span style="line-height: 1.6;">Thanks,</span></div><div><span style="line-height: 1.6;">Tianhao Shen.</span></div><div><br></div><div><br></div></span></div><!--😀-->
</div>
</body>
</html>