llvm.org GIT mirror llvm / a22c845
Refactor some code and remove the extra checks for unpckl_undef and unpckh_undef git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113043 91177308-0d34-0410-b5e6-96231b3b80d8 Bruno Cardoso Lopes 10 years ago
1 changed file(s) with 25 addition(s) and 28 deletion(s). Raw diff Collapse all Expand all
52995299 }
53005300 }
53015301
5302 if (OptForSize && X86::isUNPCKL_v_undef_Mask(SVOp)) {
5303 // NOTE: isPSHUFDMask can also match this mask, if speed is more
5304 // important than size here, this will be matched by pshufd
5305 if (VT == MVT::v4f32)
5306 return getTargetShuffleNode(X86ISD::UNPCKLPS, dl, VT, V1, V1, DAG);
5307 if (HasSSE2 && VT == MVT::v16i8)
5308 return getTargetShuffleNode(X86ISD::PUNPCKLBW, dl, VT, V1, V1, DAG);
5309 if (HasSSE2 && VT == MVT::v8i16)
5310 return getTargetShuffleNode(X86ISD::PUNPCKLWD, dl, VT, V1, V1, DAG);
5311 if (HasSSE2 && VT == MVT::v4i32)
5312 return getTargetShuffleNode(X86ISD::PUNPCKLDQ, dl, VT, V1, V1, DAG);
5313 }
5314
5315 if (OptForSize && X86::isUNPCKH_v_undef_Mask(SVOp)) {
5316 // NOTE: isPSHUFDMask can also match this mask, if speed is more
5317 // important than size here, this will be matched by pshufd
5318 if (VT == MVT::v4f32)
5319 return getTargetShuffleNode(X86ISD::UNPCKHPS, dl, VT, V1, V1, DAG);
5320 if (HasSSE2 && VT == MVT::v16i8)
5321 return getTargetShuffleNode(X86ISD::PUNPCKHBW, dl, VT, V1, V1, DAG);
5322 if (HasSSE2 && VT == MVT::v8i16)
5323 return getTargetShuffleNode(X86ISD::PUNPCKHWD, dl, VT, V1, V1, DAG);
5324 if (HasSSE2 && VT == MVT::v4i32)
5325 return getTargetShuffleNode(X86ISD::PUNPCKHDQ, dl, VT, V1, V1, DAG);
5326 }
5302 // NOTE: isPSHUFDMask can also match both masks below (unpckl_undef and
5303 // unpckh_undef). Only use pshufd if speed is more important than size.
5304 if (OptForSize && X86::isUNPCKL_v_undef_Mask(SVOp))
5305 if (VT != MVT::v2i64 && VT != MVT::v2f64)
5306 return getTargetShuffleNode(getUNPCKLOpcode(VT), dl, VT, V1, V1, DAG);
5307 if (OptForSize && X86::isUNPCKH_v_undef_Mask(SVOp))
5308 if (VT != MVT::v2i64 && VT != MVT::v2f64)
5309 return getTargetShuffleNode(getUNPCKHOpcode(VT), dl, VT, V1, V1, DAG);
53275310
53285311 if (X86::isPSHUFDMask(SVOp)) {
53295312 // The actual implementation will match the mask in the if above and then
54745457 if (!isMMX && V2.getOpcode() != ISD::UNDEF && isCommutedSHUFP(SVOp))
54755458 return CommuteVectorShuffle(SVOp, DAG);
54765459
5460 // NOTE: isPSHUFDMask can also match both masks below (unpckl_undef and
5461 // unpckh_undef). Only use pshufd if speed is more important than size.
5462 if (OptForSize && X86::isUNPCKL_v_undef_Mask(SVOp))
5463 if (VT != MVT::v2i64 && VT != MVT::v2f64)
5464 return getTargetShuffleNode(getUNPCKLOpcode(VT), dl, VT, V1, V1, DAG);
5465 if (OptForSize && X86::isUNPCKH_v_undef_Mask(SVOp))
5466 if (VT != MVT::v2i64 && VT != MVT::v2f64)
5467 return getTargetShuffleNode(getUNPCKHOpcode(VT), dl, VT, V1, V1, DAG);
5468
54775469 // The checks below are all present in isShuffleMaskLegal, but they are
54785470 // inlined here right now to enable us to directly emit target specific
54795471 // nodes, and remove one by one until they don't return Op anymore.
54925484 isPSHUFDMask(M, VT) ||
54935485 isPSHUFHWMask(M, VT) ||
54945486 isPSHUFLWMask(M, VT) ||
5495 isPALIGNRMask(M, VT, Subtarget->hasSSSE3()) ||
5496 isUNPCKL_v_undef_Mask(M, VT) ||
5497 isUNPCKH_v_undef_Mask(M, VT))
5487 isPALIGNRMask(M, VT, Subtarget->hasSSSE3()))
54985488 return Op;
5489
5490 if (X86::isUNPCKL_v_undef_Mask(SVOp))
5491 if (VT != MVT::v2i64 && VT != MVT::v2f64)
5492 return getTargetShuffleNode(getUNPCKLOpcode(VT), dl, VT, V1, V1, DAG);
5493 if (X86::isUNPCKH_v_undef_Mask(SVOp))
5494 if (VT != MVT::v2i64 && VT != MVT::v2f64)
5495 return getTargetShuffleNode(getUNPCKHOpcode(VT), dl, VT, V1, V1, DAG);
54995496
55005497 // Handle v8i16 specifically since SSE can do byte extraction and insertion.
55015498 if (VT == MVT::v8i16) {