Also avoid pinsrw and pinsrb with a variable insertelement index.
authorDan Gohman <gohman@apple.com>
Thu, 14 Aug 2008 22:53:18 +0000 (22:53 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 14 Aug 2008 22:53:18 +0000 (22:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54803 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp

index 6b95034c02beb4c1952f50e01646923f37a8fc9e..6488a1a8327b97c35351487e30809abf339f4515 100644 (file)
@@ -4143,7 +4143,8 @@ X86TargetLowering::LowerINSERT_VECTOR_ELT_SSE4(SDValue Op, SelectionDAG &DAG){
   SDValue N1 = Op.getOperand(1);
   SDValue N2 = Op.getOperand(2);
 
-  if ((EVT.getSizeInBits() == 8) || (EVT.getSizeInBits() == 16)) {
+  if ((EVT.getSizeInBits() == 8 || EVT.getSizeInBits() == 16) &&
+      isa<ConstantSDNode>(N2)) {
     unsigned Opc = (EVT.getSizeInBits() == 8) ? X86ISD::PINSRB
                                                   : X86ISD::PINSRW;
     // Transform it so it match pinsr{b,w} which expects a GR32 as its second