@@ -13921,25 +13921,27 @@ SDValue X86TargetLowering::LowerINSERT_VECTOR_ELT(SDValue Op,
13921
13921
}
13922
13922
assert(VT.is128BitVector() && "Only 128-bit vector types should be left!");
13923
13923
13924
- if (Subtarget.hasSSE41()) {
13925
- if (EltVT.getSizeInBits() == 8 || EltVT.getSizeInBits() == 16) {
13926
- unsigned Opc;
13927
- if (VT == MVT::v8i16) {
13928
- Opc = X86ISD::PINSRW;
13929
- } else {
13930
- assert(VT == MVT::v16i8);
13931
- Opc = X86ISD::PINSRB;
13932
- }
13933
-
13934
- // Transform it so it match pinsr{b,w} which expects a GR32 as its second
13935
- // argument.
13936
- if (N1.getValueType() != MVT::i32)
13937
- N1 = DAG.getNode(ISD::ANY_EXTEND, dl, MVT::i32, N1);
13938
- if (N2.getValueType() != MVT::i32)
13939
- N2 = DAG.getIntPtrConstant(IdxVal, dl);
13940
- return DAG.getNode(Opc, dl, VT, N0, N1, N2);
13924
+ // Transform it so it match pinsr{b,w} which expects a GR32 as its second
13925
+ // argument. SSE41 required for pinsrb.
13926
+ if (VT == MVT::v8i16 || (VT == MVT::v16i8 && Subtarget.hasSSE41())) {
13927
+ unsigned Opc;
13928
+ if (VT == MVT::v8i16) {
13929
+ assert(Subtarget.hasSSE2() && "SSE2 required for PINSRW");
13930
+ Opc = X86ISD::PINSRW;
13931
+ } else {
13932
+ assert(VT == MVT::v16i8 && "PINSRB requires v16i8 vector");
13933
+ assert(Subtarget.hasSSE41() && "SSE41 required for PINSRB");
13934
+ Opc = X86ISD::PINSRB;
13941
13935
}
13942
13936
13937
+ if (N1.getValueType() != MVT::i32)
13938
+ N1 = DAG.getNode(ISD::ANY_EXTEND, dl, MVT::i32, N1);
13939
+ if (N2.getValueType() != MVT::i32)
13940
+ N2 = DAG.getIntPtrConstant(IdxVal, dl);
13941
+ return DAG.getNode(Opc, dl, VT, N0, N1, N2);
13942
+ }
13943
+
13944
+ if (Subtarget.hasSSE41()) {
13943
13945
if (EltVT == MVT::f32) {
13944
13946
// Bits [7:6] of the constant are the source select. This will always be
13945
13947
// zero here. The DAG Combiner may combine an extract_elt index into
@@ -13969,24 +13971,11 @@ SDValue X86TargetLowering::LowerINSERT_VECTOR_ELT(SDValue Op,
13969
13971
return DAG.getNode(X86ISD::INSERTPS, dl, VT, N0, N1, N2);
13970
13972
}
13971
13973
13972
- if (EltVT == MVT::i32 || EltVT == MVT::i64) {
13973
- // PINSR* works with constant index.
13974
+ // PINSR* works with constant index.
13975
+ if (EltVT == MVT::i32 || EltVT == MVT::i64)
13974
13976
return Op;
13975
- }
13976
13977
}
13977
13978
13978
- if (EltVT == MVT::i8)
13979
- return SDValue();
13980
-
13981
- if (EltVT.getSizeInBits() == 16) {
13982
- // Transform it so it match pinsrw which expects a 16-bit value in a GR32
13983
- // as its second argument.
13984
- if (N1.getValueType() != MVT::i32)
13985
- N1 = DAG.getNode(ISD::ANY_EXTEND, dl, MVT::i32, N1);
13986
- if (N2.getValueType() != MVT::i32)
13987
- N2 = DAG.getIntPtrConstant(IdxVal, dl);
13988
- return DAG.getNode(X86ISD::PINSRW, dl, VT, N0, N1, N2);
13989
- }
13990
13979
return SDValue();
13991
13980
}
13992
13981
0 commit comments