mirror of
https://github.com/RPCSX/llvm.git
synced 2025-05-13 19:06:05 +00:00
[X86][SSE] Merge SSE2 PINSRW lowering with SSE41 PINSRB/PINSRW lowering. NFCI.
These are identical apart from the extra SSE41 guard for PINSRB. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293766 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
47d1df4cfd
commit
30afc90a60
@ -13921,18 +13921,19 @@ SDValue X86TargetLowering::LowerINSERT_VECTOR_ELT(SDValue Op,
|
||||
}
|
||||
assert(VT.is128BitVector() && "Only 128-bit vector types should be left!");
|
||||
|
||||
if (Subtarget.hasSSE41()) {
|
||||
if (EltVT.getSizeInBits() == 8 || EltVT.getSizeInBits() == 16) {
|
||||
// Transform it so it match pinsr{b,w} which expects a GR32 as its second
|
||||
// argument. SSE41 required for pinsrb.
|
||||
if (VT == MVT::v8i16 || (VT == MVT::v16i8 && Subtarget.hasSSE41())) {
|
||||
unsigned Opc;
|
||||
if (VT == MVT::v8i16) {
|
||||
assert(Subtarget.hasSSE2() && "SSE2 required for PINSRW");
|
||||
Opc = X86ISD::PINSRW;
|
||||
} else {
|
||||
assert(VT == MVT::v16i8);
|
||||
assert(VT == MVT::v16i8 && "PINSRB requires v16i8 vector");
|
||||
assert(Subtarget.hasSSE41() && "SSE41 required for PINSRB");
|
||||
Opc = X86ISD::PINSRB;
|
||||
}
|
||||
|
||||
// Transform it so it match pinsr{b,w} which expects a GR32 as its second
|
||||
// argument.
|
||||
if (N1.getValueType() != MVT::i32)
|
||||
N1 = DAG.getNode(ISD::ANY_EXTEND, dl, MVT::i32, N1);
|
||||
if (N2.getValueType() != MVT::i32)
|
||||
@ -13940,6 +13941,7 @@ SDValue X86TargetLowering::LowerINSERT_VECTOR_ELT(SDValue Op,
|
||||
return DAG.getNode(Opc, dl, VT, N0, N1, N2);
|
||||
}
|
||||
|
||||
if (Subtarget.hasSSE41()) {
|
||||
if (EltVT == MVT::f32) {
|
||||
// Bits [7:6] of the constant are the source select. This will always be
|
||||
// zero here. The DAG Combiner may combine an extract_elt index into
|
||||
@ -13969,24 +13971,11 @@ SDValue X86TargetLowering::LowerINSERT_VECTOR_ELT(SDValue Op,
|
||||
return DAG.getNode(X86ISD::INSERTPS, dl, VT, N0, N1, N2);
|
||||
}
|
||||
|
||||
if (EltVT == MVT::i32 || EltVT == MVT::i64) {
|
||||
// PINSR* works with constant index.
|
||||
if (EltVT == MVT::i32 || EltVT == MVT::i64)
|
||||
return Op;
|
||||
}
|
||||
}
|
||||
|
||||
if (EltVT == MVT::i8)
|
||||
return SDValue();
|
||||
|
||||
if (EltVT.getSizeInBits() == 16) {
|
||||
// Transform it so it match pinsrw which expects a 16-bit value in a GR32
|
||||
// as its second argument.
|
||||
if (N1.getValueType() != MVT::i32)
|
||||
N1 = DAG.getNode(ISD::ANY_EXTEND, dl, MVT::i32, N1);
|
||||
if (N2.getValueType() != MVT::i32)
|
||||
N2 = DAG.getIntPtrConstant(IdxVal, dl);
|
||||
return DAG.getNode(X86ISD::PINSRW, dl, VT, N0, N1, N2);
|
||||
}
|
||||
return SDValue();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user