@@ -53,10 +53,10 @@ void DAGTypeLegalizer::ScalarizeVectorResult(SDNode *N, unsigned ResNo) {
53
53
case ISD::SCALAR_TO_VECTOR: R = ScalarizeVecRes_SCALAR_TO_VECTOR (N); break ;
54
54
case ISD::SELECT: R = ScalarizeVecRes_SELECT (N); break ;
55
55
case ISD::SELECT_CC: R = ScalarizeVecRes_SELECT_CC (N); break ;
56
+ case ISD::SETCC: R = ScalarizeVecRes_SETCC (N); break ;
56
57
case ISD::UNDEF: R = ScalarizeVecRes_UNDEF (N); break ;
57
58
case ISD::VECTOR_SHUFFLE: R = ScalarizeVecRes_VECTOR_SHUFFLE (N); break ;
58
59
case ISD::VSETCC: R = ScalarizeVecRes_VSETCC (N); break ;
59
- case ISD::SETCC: R = ScalarizeVecRes_SETCC (N); break ;
60
60
61
61
case ISD::CTLZ:
62
62
case ISD::CTPOP:
@@ -207,6 +207,15 @@ SDValue DAGTypeLegalizer::ScalarizeVecRes_SELECT_CC(SDNode *N) {
207
207
N->getOperand (4 ));
208
208
}
209
209
210
+ SDValue DAGTypeLegalizer::ScalarizeVecRes_SETCC (SDNode *N) {
211
+ SDValue LHS = GetScalarizedVector (N->getOperand (0 ));
212
+ SDValue RHS = GetScalarizedVector (N->getOperand (1 ));
213
+ DebugLoc DL = N->getDebugLoc ();
214
+
215
+ // Turn it into a scalar SETCC.
216
+ return DAG.getNode (ISD::SETCC, DL, MVT::i1, LHS, RHS, N->getOperand (2 ));
217
+ }
218
+
210
219
SDValue DAGTypeLegalizer::ScalarizeVecRes_UNDEF (SDNode *N) {
211
220
return DAG.getUNDEF (N->getValueType (0 ).getVectorElementType ());
212
221
}
@@ -242,7 +251,7 @@ SDValue DAGTypeLegalizer::ScalarizeVecRes_VSETCC(SDNode *N) {
242
251
// Truncate to the final type.
243
252
return DAG.getNode (ISD::TRUNCATE, DL, NVT, Res);
244
253
}
245
-
254
+
246
255
// The SETCC result type is smaller than the vector element type.
247
256
// If the SetCC result is not sign-extended, chop it down to MVT::i1.
248
257
if (TLI.getBooleanContents () !=
@@ -251,14 +260,6 @@ SDValue DAGTypeLegalizer::ScalarizeVecRes_VSETCC(SDNode *N) {
251
260
// Sign extend to the final type.
252
261
return DAG.getNode (ISD::SIGN_EXTEND, DL, NVT, Res);
253
262
}
254
- SDValue DAGTypeLegalizer::ScalarizeVecRes_SETCC (SDNode *N) {
255
- SDValue LHS = GetScalarizedVector (N->getOperand (0 ));
256
- SDValue RHS = GetScalarizedVector (N->getOperand (1 ));
257
- DebugLoc DL = N->getDebugLoc ();
258
-
259
- // Turn it into a scalar SETCC.
260
- return DAG.getNode (ISD::SETCC, DL, MVT::i1, LHS, RHS, N->getOperand (2 ));
261
- }
262
263
263
264
264
265
// ===----------------------------------------------------------------------===//
@@ -392,14 +393,13 @@ void DAGTypeLegalizer::SplitVectorResult(SDNode *N, unsigned ResNo) {
392
393
case ISD::LOAD:
393
394
SplitVecRes_LOAD (cast<LoadSDNode>(N), Lo, Hi);
394
395
break ;
395
- case ISD::VECTOR_SHUFFLE:
396
- SplitVecRes_VECTOR_SHUFFLE (cast<ShuffleVectorSDNode>(N), Lo, Hi);
397
- break ;
398
-
399
- case ISD::VSETCC:
400
396
case ISD::SETCC:
397
+ case ISD::VSETCC:
401
398
SplitVecRes_SETCC (N, Lo, Hi);
402
399
break ;
400
+ case ISD::VECTOR_SHUFFLE:
401
+ SplitVecRes_VECTOR_SHUFFLE (cast<ShuffleVectorSDNode>(N), Lo, Hi);
402
+ break ;
403
403
404
404
case ISD::CTTZ:
405
405
case ISD::CTLZ:
@@ -735,6 +735,42 @@ void DAGTypeLegalizer::SplitVecRes_LOAD(LoadSDNode *LD, SDValue &Lo,
735
735
ReplaceValueWith (SDValue (LD, 1 ), Ch);
736
736
}
737
737
738
+ void DAGTypeLegalizer::SplitVecRes_SETCC (SDNode *N, SDValue &Lo, SDValue &Hi) {
739
+ MVT LoVT, HiVT;
740
+ DebugLoc DL = N->getDebugLoc ();
741
+ GetSplitDestVTs (N->getValueType (0 ), LoVT, HiVT);
742
+
743
+ // Split the input.
744
+ MVT InVT = N->getOperand (0 ).getValueType ();
745
+ SDValue LL, LH, RL, RH;
746
+ switch (getTypeAction (InVT)) {
747
+ default : assert (0 && " Unexpected type action!" );
748
+ case WidenVector: assert (0 && " Unimp" );
749
+ case Legal: {
750
+ assert (LoVT == HiVT && " Legal non-power-of-two vector type?" );
751
+ MVT InNVT = MVT::getVectorVT (InVT.getVectorElementType (),
752
+ LoVT.getVectorNumElements ());
753
+ LL = DAG.getNode (ISD::EXTRACT_SUBVECTOR, DL, InNVT, N->getOperand (0 ),
754
+ DAG.getIntPtrConstant (0 ));
755
+ LH = DAG.getNode (ISD::EXTRACT_SUBVECTOR, DL, InNVT, N->getOperand (0 ),
756
+ DAG.getIntPtrConstant (InNVT.getVectorNumElements ()));
757
+
758
+ RL = DAG.getNode (ISD::EXTRACT_SUBVECTOR, DL, InNVT, N->getOperand (1 ),
759
+ DAG.getIntPtrConstant (0 ));
760
+ RH = DAG.getNode (ISD::EXTRACT_SUBVECTOR, DL, InNVT, N->getOperand (1 ),
761
+ DAG.getIntPtrConstant (InNVT.getVectorNumElements ()));
762
+ break ;
763
+ }
764
+ case SplitVector:
765
+ GetSplitVector (N->getOperand (0 ), LL, LH);
766
+ GetSplitVector (N->getOperand (1 ), RL, RH);
767
+ break ;
768
+ }
769
+
770
+ Lo = DAG.getNode (N->getOpcode (), DL, LoVT, LL, RL, N->getOperand (2 ));
771
+ Hi = DAG.getNode (N->getOpcode (), DL, HiVT, LH, RH, N->getOperand (2 ));
772
+ }
773
+
738
774
void DAGTypeLegalizer::SplitVecRes_UnaryOp (SDNode *N, SDValue &Lo,
739
775
SDValue &Hi) {
740
776
// Get the dest types - they may not match the input types, e.g. int_to_fp.
@@ -889,41 +925,6 @@ void DAGTypeLegalizer::SplitVecRes_VECTOR_SHUFFLE(ShuffleVectorSDNode *N,
889
925
}
890
926
}
891
927
892
- void DAGTypeLegalizer::SplitVecRes_SETCC (SDNode *N, SDValue &Lo, SDValue &Hi) {
893
- MVT LoVT, HiVT;
894
- DebugLoc DL = N->getDebugLoc ();
895
- GetSplitDestVTs (N->getValueType (0 ), LoVT, HiVT);
896
-
897
- // Split the input.
898
- MVT InVT = N->getOperand (0 ).getValueType ();
899
- SDValue LL, LH, RL, RH;
900
- switch (getTypeAction (InVT)) {
901
- default : assert (0 && " Unexpected type action!" );
902
- case WidenVector: assert (0 && " Unimp" );
903
- case Legal: {
904
- assert (LoVT == HiVT && " Legal non-power-of-two vector type?" );
905
- MVT InNVT = MVT::getVectorVT (InVT.getVectorElementType (),
906
- LoVT.getVectorNumElements ());
907
- LL = DAG.getNode (ISD::EXTRACT_SUBVECTOR, DL, InNVT, N->getOperand (0 ),
908
- DAG.getIntPtrConstant (0 ));
909
- LH = DAG.getNode (ISD::EXTRACT_SUBVECTOR, DL, InNVT, N->getOperand (0 ),
910
- DAG.getIntPtrConstant (InNVT.getVectorNumElements ()));
911
-
912
- RL = DAG.getNode (ISD::EXTRACT_SUBVECTOR, DL, InNVT, N->getOperand (1 ),
913
- DAG.getIntPtrConstant (0 ));
914
- RH = DAG.getNode (ISD::EXTRACT_SUBVECTOR, DL, InNVT, N->getOperand (1 ),
915
- DAG.getIntPtrConstant (InNVT.getVectorNumElements ()));
916
- break ;
917
- }
918
- case SplitVector:
919
- GetSplitVector (N->getOperand (0 ), LL, LH);
920
- GetSplitVector (N->getOperand (1 ), RL, RH);
921
- break ;
922
- }
923
-
924
- Lo = DAG.getNode (N->getOpcode (), DL, LoVT, LL, RL, N->getOperand (2 ));
925
- Hi = DAG.getNode (N->getOpcode (), DL, HiVT, LH, RH, N->getOperand (2 ));
926
- }
927
928
928
929
// ===----------------------------------------------------------------------===//
929
930
// Operand Vector Splitting
@@ -1149,7 +1150,7 @@ void DAGTypeLegalizer::WidenVectorResult(SDNode *N, unsigned ResNo) {
1149
1150
case ISD::SELECT: Res = WidenVecRes_SELECT (N); break ;
1150
1151
case ISD::SELECT_CC: Res = WidenVecRes_SELECT_CC (N); break ;
1151
1152
case ISD::UNDEF: Res = WidenVecRes_UNDEF (N); break ;
1152
- case ISD::VECTOR_SHUFFLE:
1153
+ case ISD::VECTOR_SHUFFLE:
1153
1154
Res = WidenVecRes_VECTOR_SHUFFLE (cast<ShuffleVectorSDNode>(N));
1154
1155
break ;
1155
1156
case ISD::VSETCC:
@@ -1464,7 +1465,7 @@ SDValue DAGTypeLegalizer::WidenVecRes_CONCAT_VECTORS(SDNode *N) {
1464
1465
MaskOps[i] = i;
1465
1466
MaskOps[i+WidenNumElts/2 ] = i+WidenNumElts;
1466
1467
}
1467
- return DAG.getVectorShuffle (WidenVT, dl,
1468
+ return DAG.getVectorShuffle (WidenVT, dl,
1468
1469
GetWidenedVector (N->getOperand (0 )),
1469
1470
GetWidenedVector (N->getOperand (1 )),
1470
1471
&MaskOps[0 ]);
0 commit comments