Hi all,
I am trying to replace *selectcc* with our own IL like *cmp_eq_cmpval*. The
formats for cmp_eq_cmpval and select_cc are described in the comments. The
following is my code.
However, the 1st operand (highlighted with bold red color, i.e.,
(type:$src1)) is illegal, and its error is "error:Illegal operand for the
'ZERO_EQrirr' instruction!" Could anybody here point me out
what kind of solution can be? Thanks!
//-------------------------------------------------------------------//
// Multiclasses that deal with the cmp instruction.
// *cmp_eq_cmpval(cmpval) dst, src0, src1, src2*
// *select_cc lhs, rhs, true, false, cond*
//-------------------------------------------------------------------//
def cond_seteq_setoeq : PatLeaf <(cond), [{
return N->get() == ISD::SETEQ || N->get() == ISD::SETOEQ;
}]>;
multiclass CmpRelop<RegisterClass reg, ValueType type,
string conststr, PatLeaf cc, string ccstr> {
def rirr : ILFormat<IL_OP_CMP,
(outs GPR_32:$dst),
(ins (reg:$src0), (type:$src1), (reg:$src2), (reg:$src3)),
!strconcat(IL_OP_CMP.Text, "_($ccstr)_cmpval($conststr) $dst,
$src0, $src2, $src3"),
[(set GPR_32:$dst,
(selectcc (type reg:$src0), *(type:$src1),* (type
reg:$src2), (type reg:$src3), cc))]>;
}
multiclass CmpRelopExpand<string conststr> {
defm EQ : CmpRelop<GPR_32, f32, conststr, cond_seteq_setoeq,
"eq">;
}
defm ZERO_ : CmpRelopExpand<"0.0">;
___
Regards,
Ke
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20140401/0155da3f/attachment.html>