<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi,</div><div><br></div><div>This is a patch that implements changing the shuffle vector definition to </div><div><div><div><span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 14px; white-space: pre; "><font class="Apple-style-span" size="1"><span class="Apple-style-span" style="font-size: 9px; ">  <result> = shufflevector <n x <ty>> <v1>, <n x <ty>> <v2>, <m x i32> <mask>    </span></font><i><font class="Apple-style-span" size="1"><span class="Apple-style-span" style="font-size: 9px; ">; yields <m x <ty>></span></font></i></span></div></div><div><br></div><div>As discussed in llvmdev, the reason for this change is to help maintain the incoming vector structure of the user code instead of converting to insert and extract.</div><div><br></div><div>During the SelectionDAG, we normalize the shuffle vector such that the vectors and mask are the same size and then we legalize the shuffle vectors.  The normalization process tries to retain the structure of the vector shuffle by trying to convert it to a series of concat vectors, extract subvector, and vector shuffles. If it can't, it falls back to using insert/extracts. This implementation normalizes during DAG construction while in a earlier implementation  normalized during the Legalize phase.  The pros of doing this way is that after DAG construction, none of the DAG passes would have to worry about non-normalized shuffles, we might be able to optimize the normalized shuffles, and in LegalizeTypes, we wouldn't have to do a pass to normalize the vector shuffles. (We could probably do normalization when we iterate the DAG to build the worklist in LegalizeTypes).  The downside is no DAG optimization can generate a non-normalized shufflevector and there may be cases where after normalization, we may obscure the what the original structure is.  Here is the patch.  I've a few more test cases that I didn't include in the patch.</div><div><br></div><div>Thanks,</div><div>-- Mon Ping</div><div><br></div><div></div></div></body></html>