[LLVMdev] Unsigned CCCondCode Legalization

Johnny Val johnnydval at gmail.com
Mon Dec 1 02:46:11 PST 2014


Hi,

Currently, if a target cannot perform unsigned comparisons the
legalizer will hit a llvm_unreachable. This is easily achieved by
telling the legalizer to expand all unsigned condcodes.

setCondCodeAction(ISD::SETUxx, MVT::ixx, Expand);


This is because in SelectionDAGLegalize::LegalizeSetCCCondCode it will
only attempt to invert an operation and not any other expansions.

To convert from an unsigned integer operation to a singed one whilst
still keeping the same result, zero extending to iN + 1 and removing
the unsigned flag from the CCCode should be enough (as far as I can
tell).

I was wondering if this type of expansion purposefully was not
implemented (and if I'm missing something obvious), or if it is worth
writing a patch for this.

Cheers,

Johnny



More information about the llvm-dev mailing list