[llvm-commits] [llvm] r142660 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp test/CodeGen/X86/2011-20-21-zext-ui2fp.ll
Duncan Sands
baldrick at free.fr
Fri Oct 21 13:05:15 PDT 2011
Hi Nadav,
> --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Fri Oct 21 12:35:19 2011
> @@ -787,7 +787,17 @@
> break;
> }
> case TargetLowering::TypePromoteInteger: {
> - SDValue InOp = GetPromotedInteger(N->getOperand(0));
> + SDValue InOp;
> + if (N->getOpcode() == ISD::SIGN_EXTEND ||
> + N->getOpcode() == ISD::SINT_TO_FP) {
> + InOp = SExtPromotedInteger(N->getOperand(0));
> + } else if (
> + N->getOpcode() == ISD::ZERO_EXTEND ||
> + N->getOpcode() == ISD::UINT_TO_FP) {
> + InOp = ZExtPromotedInteger(N->getOperand(0));
> + } else {
> + InOp = GetPromotedInteger(N->getOperand(0));
> + }
> EVT InNVT = EVT::getVectorVT(*DAG.getContext(),
> InOp.getValueType().getVectorElementType(),
> LoVT.getVectorNumElements());
how about deleting the entire switch? Instead you can just always chop the
input in two using an EXTRACT_SUBVECTOR without trying to play with types or
do anything clever. The type legalization machinery will take care of
legalizing the operands automatically later. As far as I can see there is
only one useful bit of logic here: if the input is split (TypeSplitVector) then
you can do a little optimization (and that's all it is - saving some compile
time) by grabbing the split input. So I suggest you keep that bit and in all
other cases do that same as is currently done in the TypeLegal case.
> @@ -2189,8 +2199,7 @@
> SDValue CC = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl,
> ResVT, WideSETCC, DAG.getIntPtrConstant(0));
>
> - // Convert the result mask to the correct kind.
> - return DAG.getAnyExtOrTrunc(CC, dl, N->getValueType(0));
> + return PromoteTargetBoolean(CC, N->getValueType(0));
PromoteTargetBoolean doesn't handle the case of truncation. I don't know if
that can really occur here, but maybe you can teach it to do a trunc if needed
(don't forget to update the descriptive comment, in the header as well as in
LegalizeTypes.cpp).
Ciao, Duncan.
More information about the llvm-commits
mailing list