[llvm-commits] [llvm] r111837 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Chris Lattner clattner at apple.com
Mon Aug 23 15:54:34 PDT 2010


On Aug 23, 2010, at 2:40 PM, Bruno Cardoso Lopes wrote:

> On Mon, Aug 23, 2010 at 2:36 PM, Chris Lattner <clattner at apple.com> wrote:
>> On Aug 23, 2010, at 1:41 PM, Bruno Cardoso Lopes wrote:
>>> URL: http://llvm.org/viewvc/llvm-project?rev=111837&view=rev
>>> Log:
>>> Start using target speficic nodes for shuffles: pshufhw and pshuflw
>> 
>> Cool!
>> 
>>> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Aug 23 15:41:02 2010
>>> @@ -2558,6 +2558,18 @@
>>> //                           Other Lowering Hooks
>>> //===----------------------------------------------------------------------===//
>>> 
>>> +static SDValue getTargetShuffleNode(unsigned Opc, DebugLoc dl, EVT VT,
>>> +              SDValue V1, SDValue V2, unsigned TargetMask, SelectionDAG &DAG) {
>> 
>> Should this be named something like "getPSHUF" or do you plan to expand this to other shuffle nodes that take an i8 immediate?  getTargetShuffleNode seems like an overly generic name.
> 
> I'm open to better names, but the idea is to have something that would
> match several types of x86 "shuffle capable" instructions:
> 
> static SDValue getTargetShuffleNode(unsigned Opc, DebugLoc dl, EVT VT,
>          SDValue V1, SDValue V2, unsigned TargetMask, SelectionDAG &DAG) {

I think it would make sense to have one method that handles shuffles that take an immediate, one that makes shuffles with one vector, one with shuffles that have two vectors etc.  Basically, one per prototype :)

-Chris

> 
>  switch(Opc) {
>  case X86ISD::PSHUFD:
>  case X86ISD::PSHUFHW:
>  case X86ISD::PSHUFHW_LD:
>  case X86ISD::PSHUFLW:
>  case X86ISD::PSHUFLW_LD:
>    return DAG.getNode(Opc, dl, VT, V1, DAG.getConstant(TargetMask, MVT::i8));
>  case X86ISD::PALIGN:
>  case X86ISD::SHUFPD:
>  case X86ISD::SHUFPS:
>    return DAG.getNode(Opc, dl, VT, V1, V2,
>                            DAG.getConstant(TargetMask, MVT::i8));
>  case X86ISD::MOVLHPS:
>  case X86ISD::MOVHLPS:
>  case X86ISD::MOVLHPD:
>  case X86ISD::MOVHLPD:
>  case X86ISD::MOVHPS:
>  case X86ISD::MOVLPS:
>  case X86ISD::MOVHPD:
>  case X86ISD::MOVLPD:
>  case X86ISD::MOVSD:
>  case X86ISD::MOVSS:
>  case X86ISD::UNPCKLPS:
>  case X86ISD::UNPCKLPD:
>  case X86ISD::UNPCKHPS:
>  case X86ISD::UNPCKHPD:
>  case X86ISD::PUNPCKLBW:
>  case X86ISD::PUNPCKLWD:
>  case X86ISD::PUNPCKLDQ:
>  case X86ISD::PUNPCKLQDQ:
>  case X86ISD::PUNPCKHBW:
>  case X86ISD::PUNPCKHWD:
>  case X86ISD::PUNPCKHDQ:
>  case X86ISD::PUNPCKHQDQ:
>    return DAG.getNode(Opc, dl, VT, V1, V2);
>  case X86ISD::MOVDDUP:
>  case X86ISD::MOVSHDUP:
>  case X86ISD::MOVSLDUP:
>  case X86ISD::MOVSHDUP_LD:
>  case X86ISD::MOVSLDUP_LD:
>    return DAG.getNode(Opc, dl, VT, V1);
>  default:
>    assert(false && "Unknown x86 target specific shuffle node.");
>  }
> 
>  return SDValue();
> }
> 
> 
> 
> -- 
> Bruno Cardoso Lopes
> http://www.brunocardoso.cc





More information about the llvm-commits mailing list