[PATCH] Fix vselect when getSetCCResultType returns a different type from the operands
Nadav Rotem
nrotem at apple.com
Mon May 6 14:38:12 PDT 2013
- assert(VT.getSizeInBits() == Op1.getValueType().getSizeInBits()
- && "Invalid mask size");
+ // If the mask and the type do not match and Select is legal,
+ // go ahead and unroll the vector op.
+ // This occurs when getSetCCResultType returns something that
+ // is different than the operand types. For example,
+ // v4i8 = select v4i32, v4i8, v4i8.
+ if (Op1.getValueType() != VT &&
+ TLI.getTypeAction(*DAG.getContext(), VT.getScalarType())
+ == TargetLowering::TypeLegal &&
+ TLI.getOperationAction(ISD::SELECT, VT.getScalarType())
+ == TargetLowering::Legal) {
+ return DAG.UnrollVectorOp(Op.getNode());
+ }
+
You don't need to check if the scalar SELECT operation is legal, just scalarize it and let the code that legalizes the scalar selects worry about it. I am okay with replacing the assert with DAG.UnrollVectorOp.
On May 6, 2013, at 2:30 PM, Matt Arsenault <Matthew.Arsenault at amd.com> wrote:
>
> I haven't managed to get the same situation to arise with any of the in tree backends
>
> http://llvm-reviews.chandlerc.com/D743
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130506/02bc47cf/attachment.html>
More information about the llvm-commits
mailing list