[PATCH] Add a target legalize hook for SplitVectorOperand

Eli Friedman eli.friedman at gmail.com
Mon Jul 22 18:20:45 PDT 2013


On Mon, Jul 22, 2013 at 6:03 PM, Justin Holewinski
<justin.holewinski at gmail.com> wrote:
> To be more specific, the X86 target declares that v2i64 extract_vector_elt
> needs to be custom lowered:
>
>     if (Subtarget->is64Bit()) {
>       setOperationAction(ISD::INSERT_VECTOR_ELT,  MVT::v2i64, Custom);
>       setOperationAction(ISD::EXTRACT_VECTOR_ELT, MVT::v2i64, Custom);
>     }
>
> But if the element type is i64 and the index is constant, then its lowered
> to itself:
>
>   if (VT == MVT::i32 || VT == MVT::i64) {
>     // ExtractPS/pextrq works with constant index.
>     if (isa<ConstantSDNode>(Op.getOperand(1)))
>       return Op;
>   }

If you don't mind fixing it, the condition should be "VT == MVT::i32
|| (Subtarget->is64Bit() && VT == MVT::i64))".  Same idea applies to
LowerINSERT_VECTOR_ELT_SSE4.

-Eli



More information about the llvm-commits mailing list