llvm.org GIT mirror llvm / 2a44606
Reintroduce a simple function refactoring done in r112934, also without any functionality changes git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113008 91177308-0d34-0410-b5e6-96231b3b80d8 Bruno Cardoso Lopes 10 years ago
1 changed file(s) with 12 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
50565056 return DAG.getVectorShuffle(VT, dl, LoShuffle, HiShuffle, &MaskOps[0]);
50575057 }
50585058
5059 static bool MayFoldVectorLoad(SDValue V) {
5060 if (V.hasOneUse() && V.getOpcode() == ISD::BIT_CONVERT)
5061 V = V.getOperand(0);
5062 if (V.hasOneUse() && V.getOpcode() == ISD::SCALAR_TO_VECTOR)
5063 V = V.getOperand(0);
5064 if (MayFoldLoad(V))
5065 return true;
5066 return false;
5067 }
5068
50595069 static
50605070 SDValue getMOVLowToHigh(SDValue &Op, DebugLoc &dl, SelectionDAG &DAG,
50615071 bool HasSSE2) {
51005110 // potencial load folding here, otherwise use SHUFPS or MOVSD to match the
51015111 // same masks.
51025112 bool CanFoldLoad = false;
5103 SDValue TmpV1 = V1;
5104 SDValue TmpV2 = V2;
51055113
51065114 // Trivial case, when V2 comes from a load.
5107 if (TmpV2.hasOneUse() && TmpV2.getOpcode() == ISD::BIT_CONVERT)
5108 TmpV2 = TmpV2.getOperand(0);
5109 if (TmpV2.hasOneUse() && TmpV2.getOpcode() == ISD::SCALAR_TO_VECTOR)
5110 TmpV2 = TmpV2.getOperand(0);
5111 if (MayFoldLoad(TmpV2))
5115 if (MayFoldVectorLoad(V2))
51125116 CanFoldLoad = true;
51135117
51145118 // When V1 is a load, it can be folded later into a store in isel, example:
51165120 // turns into:
51175121 // (MOVLPSmr addr:$src1, VR128:$src2)
51185122 // So, recognize this potential and also use MOVLPS or MOVLPD
5119 if (TmpV1.hasOneUse() && TmpV1.getOpcode() == ISD::BIT_CONVERT)
5120 TmpV1 = TmpV1.getOperand(0);
5121 if (MayFoldLoad(TmpV1) && MayFoldIntoStore(Op))
5123 if (MayFoldVectorLoad(V1) && MayFoldIntoStore(Op))
51225124 CanFoldLoad = true;
51235125
51245126 if (CanFoldLoad) {