[LLVMdev] i1 promotion issue (again)

Scott Michel
Fri, 12 Dec 2008 19:42:54 -0000

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.

Problem: LegalizeTypes promotes i1 to i8 via an i32 setcc, i.e., the
generated type legalization is:

	(i8:truncate (i32:setcc i32:lhs, i32:rhs, ch:cond))

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!"?

The alternative is to do fairly deep inspection of brconds to
eliminate the truncate, which eventually gets expanded into:

	(i8:sext_in_reg (i8:truncate (i32:setcc ...)))


-scooter

-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20081212/397249df/attachment.html>