<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Matt,  <div><br></div><div>Thanks for working on this. The change LGTM.  Is there an in-tree target that you can test it with  ?</div><div><br></div><div>Thanks,</div><div>Nadav</div><div><br><div><div>On May 3, 2013, at 8:42 PM, Matt Arsenault <<a href="mailto:Matthew.Arsenault@amd.com">Matthew.Arsenault@amd.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Hi nadav,<br><br><a href="http://llvm-reviews.chandlerc.com/D743">http://llvm-reviews.chandlerc.com/D743</a><br><br>Files:<br> lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp<br><br>Index: lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp<br>===================================================================<br>--- lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp<br>+++ lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp<br>@@ -652,13 +652,14 @@<br>SDValue VectorLegalizer::ExpandVSELECT(SDValue Op) {<br>  // Implement VSELECT in terms of XOR, AND, OR<br>  // on platforms which do not support blend natively.<br>-  EVT VT =  Op.getOperand(0).getValueType();<br>  DebugLoc DL = Op.getDebugLoc();<br><br>  SDValue Mask = Op.getOperand(0);<br>  SDValue Op1 = Op.getOperand(1);<br>  SDValue Op2 = Op.getOperand(2);<br><br>+  EVT VT = Mask.getValueType();<br>+<br>  // If we can't even use the basic vector operations of<br>  // AND,OR,XOR, we will have to scalarize the op.<br>  // Notice that the operation may be 'promoted' which means that it is<br>@@ -673,8 +674,22 @@<br>      TargetLowering::ZeroOrNegativeOneBooleanContent)<br>    return DAG.UnrollVectorOp(Op.getNode());<br><br>-  assert(VT.getSizeInBits() == Op1.getValueType().getSizeInBits()<br>-         && "Invalid mask size");<br>+  // If the mask and the type do not match and Select is legal,<br>+  // go ahead and unroll the vector op.<br>+  // This occurs when getSetCCResultType returns something that<br>+  // is different than the operand types. For example,<br>+  // v4i8 = select v4i32, v4i8, v4i8.<br>+  if (Op1.getValueType() != VT &&<br>+      TLI.getTypeAction(*DAG.getContext(), VT.getScalarType())<br>+        == TargetLowering::TypeLegal &&<br>+      TLI.getOperationAction(ISD::SELECT, VT.getScalarType())<br>+        == TargetLowering::Legal) {<br>+    return DAG.UnrollVectorOp(Op.getNode());<br>+  }<br>+<br>+  assert(VT.getSizeInBits() == Op.getOperand(1).getValueType().getSizeInBits()<br>+         && "Invalid mask size and ISD::SELECT is not Legal!");<br>+<br>  // Bitcast the operands to be the same type as the mask.<br>  // This is needed when we select between FP types because<br>  // the mask is a vector of integers.<br><span><D743.1.patch></span></div></blockquote></div><br></div></body></html>