<div dir="ltr"><div>To be more specific, the X86 target declares that v2i64 extract_vector_elt needs to be custom lowered:<br><br><span style="font-family:courier new,monospace">    if (Subtarget->is64Bit()) {<br>      setOperationAction(ISD::INSERT_VECTOR_ELT,  MVT::v2i64, Custom);<br>
      setOperationAction(ISD::EXTRACT_VECTOR_ELT, MVT::v2i64, Custom);<br>    }</span><br><br></div>But if the element type is i64 and the index is constant, then its lowered to itself:<br><div><br><span style="font-family:courier new,monospace">  if (VT == MVT::i32 || VT == MVT::i64) {<br>
    // ExtractPS/pextrq works with constant index.<br>    if (isa<ConstantSDNode>(Op.getOperand(1)))<br>      return Op;<br>  }</span><br><br><br><br></div><div>Since this is specific to SSE 4.1, I could always add "-mattr=-sse41" to the run line, but that would make the test X86-specific.<br>
<br><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jul 22, 2013 at 8:50 PM, Justin Holewinski <span dir="ltr"><<a href="mailto:justin.holewinski@gmail.com" target="_blank">justin.holewinski@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><p dir="ltr">Unfortunately, it's not my lowering code.  This change triggers a legalization loop in CodeGen/Generic/2009-03-29-SoftFloatVectorExtract.ll when X86 is used as the default.  The X86 target lowers an i64 extract_vector_elt to itself, causing the loop.  I don't know enough about the X86 custom lowering code to know where to start looking.  I'll see if I can identify the issue.<br>

</p><div><div class="h5">
<div class="gmail_quote">On Jul 22, 2013 6:05 PM, "Eli Friedman" <<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


On Mon, Jul 22, 2013 at 10:10 AM, Justin Holewinski<br>
<<a href="mailto:justin.holewinski@gmail.com" target="_blank">justin.holewinski@gmail.com</a>> wrote:<br>
> CustomLowerNode was not being called during SplitVectorOperand,<br>
> meaning custom legalization could not be used by targets.<br>
><br>
> Is there a reason this is missing, or just an oversight?<br>
><br>
> This also adds a test case for NVPTX that depends on this custom<br>
> legalization.<br>
><br>
> <a href="http://llvm-reviews.chandlerc.com/D1195" target="_blank">http://llvm-reviews.chandlerc.com/D1195</a><br>
><br>
> Files:<br>
>   lib/CodeGen/SelectionDAG/LegalizeTypes.cpp<br>
>   lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp<br>
>   test/CodeGen/NVPTX/vector-stores.ll<br>
><br>
> Index: lib/CodeGen/SelectionDAG/LegalizeTypes.cpp<br>
> ===================================================================<br>
> --- lib/CodeGen/SelectionDAG/LegalizeTypes.cpp<br>
> +++ lib/CodeGen/SelectionDAG/LegalizeTypes.cpp<br>
> @@ -919,6 +919,11 @@<br>
>      // The target didn't want to custom lower it after all.<br>
>      return false;<br>
><br>
> +  if (!LegalizeResult && Results[0].getNode() == N)<br>
> +    // The target just returned the same node, so it must not have wanted to<br>
> +    // custom lower it after all.<br>
> +    return false;<br>
<br>
Please fix your custom lowering implementation...<br>
<br>
>    // Make everything that once used N's values now use those in Results instead.<br>
>    assert(Results.size() == N->getNumValues() &&<br>
>           "Custom lowering returned the wrong number of results!");<br>
> Index: lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp<br>
> ===================================================================<br>
> --- lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp<br>
> +++ lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp<br>
> @@ -1031,6 +1031,10 @@<br>
>          dbgs() << "\n");<br>
>    SDValue Res = SDValue();<br>
><br>
> +  // See if the target wants to custom split this node.<br>
> +  if (CustomLowerNode(N, N->getOperand(OpNo).getValueType(), false))<br>
> +    return false;<br>
> +<br>
>    if (Res.getNode() == 0) {<br>
>      switch (N->getOpcode()) {<br>
>      default:<br>
<br>
This looks fine.<br>
<br>
-Eli<br>
</blockquote></div>
</div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br><br><div>Thanks,</div><div><br></div><div>Justin Holewinski</div>
</div>