<div dir="ltr"><div class="gmail_default"><div class="gmail_default"><font color="#0b5394">Hi all,</font></div><div class="gmail_default"><font color="#0b5394"><br></font></div><div class="gmail_default"><font color="#0b5394">I am trying to replace <b>selectcc</b> with our own IL like <b>cmp_eq_cmpval</b>. The formats for </font><span style="color:rgb(11,83,148)">cmp_eq_cmpval and select_cc are described in the comments. The following is my code. </span></div>
<div class="gmail_default"><span style="color:rgb(11,83,148)">However, the </span><font color="#0b5394">1st operand (highlighted with bold red color, i.e., (type:$src1)) is illegal, and its error is "</font><span style="color:rgb(11,83,148)">error:Illegal operand for the 'ZERO_EQrirr' instruction!" Could anybody here point me out </span></div>
<div class="gmail_default"><span style="color:rgb(11,83,148)">what kind of solution can be? Thanks!</span></div><div class="gmail_default"><font color="#0b5394"><br></font></div><div class="gmail_default"><font color="#0b5394">//-------------------------------------------------------------------//</font></div>
<div class="gmail_default"><font color="#0b5394">// Multiclasses that deal with the cmp instruction.</font></div><div class="gmail_default"><font color="#0b5394">// <b>cmp_eq_cmpval(cmpval) dst, src0, src1, src2</b></font></div>
<div class="gmail_default"><font color="#0b5394">// <b>select_cc lhs, rhs, true, false, cond</b></font></div><div class="gmail_default"><font color="#0b5394">//-------------------------------------------------------------------//</font></div>
<div class="gmail_default"><font color="#0b5394"><br></font></div><div class="gmail_default"><span style="color:rgb(11,83,148)">def cond_seteq_setoeq : PatLeaf <(cond), [{</span><br></div><div class="gmail_default"><font color="#0b5394"> return N->get() == ISD::SETEQ || N->get() == ISD::SETOEQ;</font></div>
<div class="gmail_default"><font color="#0b5394">}]>;</font></div><div class="gmail_default"><font color="#0b5394"><br></font></div><div class="gmail_default"><font color="#0b5394">multiclass CmpRelop<RegisterClass reg, ValueType type,</font></div>
<div class="gmail_default"><font color="#0b5394"> string conststr, PatLeaf cc, string ccstr> {</font></div><div class="gmail_default"><font color="#0b5394"> def rirr : ILFormat<IL_OP_CMP,</font></div>
<div class="gmail_default"><font color="#0b5394"> (outs GPR_32:$dst),</font></div><div class="gmail_default"><font color="#0b5394"> (ins (reg:$src0), (type:$src1), (reg:$src2), (reg:$src3)),</font></div><div class="gmail_default">
<font color="#0b5394"> !strconcat(IL_OP_CMP.Text, "_($ccstr)_cmpval($conststr) $dst, $src0, $src2, $src3"),</font></div><div class="gmail_default"><font color="#0b5394"> [(set GPR_32:$dst,</font></div>
<div class="gmail_default"><font color="#0b5394"> (selectcc (type reg:$src0), </font><font color="#ff0000"><b>(type:$src1),</b></font><font color="#0b5394"><b> </b>(type reg:$src2), (type reg:$src3), cc))]>;</font></div>
<div class="gmail_default"><font color="#0b5394">}</font></div><div class="gmail_default"><font color="#0b5394"> </font></div><div class="gmail_default"><font color="#0b5394">multiclass CmpRelopExpand<string conststr> {</font></div>
<div class="gmail_default"><font color="#0b5394"> defm EQ : CmpRelop<GPR_32, f32, conststr, cond_seteq_setoeq, "eq">;</font></div><div class="gmail_default"><font color="#0b5394">}</font></div><div class="gmail_default">
<font color="#0b5394"><br></font></div><div class="gmail_default"><font color="#0b5394">defm ZERO_ : CmpRelopExpand<"0.0">;</font></div><div class="gmail_default"><font color="#0b5394"><br></font></div>
<div class="gmail_default"><font color="#0b5394">___</font></div><div class="gmail_default"><font color="#0b5394">Regards,</font></div><div class="gmail_default"><font color="#0b5394">Ke</font></div></div></div>