<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
Background: The Cell SPU does not have condition registers in the normal sense. It fits the "zero or negative one" model, preferably with an i32 register, which is what getSetCCResultType() will return.<div><br></div><div>Problem: LegalizeTypes promotes i1 to i8 via an i32 setcc, i.e., the generated type legalization is:</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">     </span><font class="Apple-style-span" face="Courier">(i8:truncate (i32:setcc i32:lhs, i32:rhs, ch:cond))</font><br></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div>How do I keep DAGTypeLegalizer::PromoteIntRes_SETCC() from inserting the truncate without blowing all other type promotion out of the water (having everything promoted up to i32 as a consequence)? Would it be permissible to add a virtual function to TargetLowering such that the target can effectively say, "Really, the setcc is legal, no need to truncate!"?</div><div><br></div><div>The alternative is to do fairly deep inspection of brconds to eliminate the truncate, which eventually gets expanded into:</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">   </span><font class="Apple-style-span" face="Courier">(i8:sext_in_reg (i8:truncate (i32:setcc ...)))</font><br></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier">-scooter</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div></body></html>