<div dir="ltr">Everything it could do can be implemented with the generic vector_shuffle instruction and/or using ConstantAggregateZero input.<div><br></div><div>Here's the code from lib/IR/AutoUpgrade.cpp that we use to upgrade it if we see it in IR input to opt or llc</div><div><br></div><div><div> uint8_t Imm = cast<ConstantInt>(CI->getArgOperand(2))->getZExtValue();</div><div><br></div><div> unsigned NumElts = CI->getType()->getVectorNumElements();</div><div> unsigned HalfSize = NumElts / 2;</div><div> SmallVector<uint32_t, 8> ShuffleMask(NumElts);</div><div><br></div><div> // Determine which operand(s) are actually in use for this instruction.</div><div> Value *V0 = (Imm & 0x02) ? CI->getArgOperand(1) : CI->getArgOperand(0);</div><div> Value *V1 = (Imm & 0x20) ? CI->getArgOperand(1) : CI->getArgOperand(0);</div><div><br></div><div> // If needed, replace operands based on zero mask.</div><div> V0 = (Imm & 0x08) ? ConstantAggregateZero::get(CI->getType()) : V0;</div><div> V1 = (Imm & 0x80) ? ConstantAggregateZero::get(CI->getType()) : V1;</div><div><br></div><div> // Permute low half of result.</div><div> unsigned StartIndex = (Imm & 0x01) ? HalfSize : 0;</div><div> for (unsigned i = 0; i < HalfSize; ++i)</div><div> ShuffleMask[i] = StartIndex + i;</div><div><br></div><div> // Permute high half of result.</div><div> StartIndex = (Imm & 0x10) ? HalfSize : 0;</div><div> for (unsigned i = 0; i < HalfSize; ++i)</div><div> ShuffleMask[i + HalfSize] = NumElts + StartIndex + i;</div><div><br></div><div> Rep = Builder.CreateShuffleVector(V0, V1, ShuffleMask);</div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div>
<br><div class="gmail_quote">On Sun, Nov 12, 2017 at 12:55 PM, Rob Cameron via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi, there. I am unable to use the above intrinsic<br>
with LLVM 6.0svn. Is there a substitute?<br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br></div>