@@ -3036,6 +3036,8 @@ static SDValue LowerVectorSELECT_CC(SDValue Op, SelectionDAG &DAG) {
3036
3036
SDValue RHS = Op.getOperand (1 );
3037
3037
SDValue IfTrue = Op.getOperand (2 );
3038
3038
SDValue IfFalse = Op.getOperand (3 );
3039
+ EVT IfTrueVT = IfTrue.getValueType ();
3040
+ EVT CondVT = IfTrueVT.changeVectorElementTypeToInteger ();
3039
3041
ISD::CondCode CC = cast<CondCodeSDNode>(Op.getOperand (4 ))->get ();
3040
3042
3041
3043
// If LHS & RHS are floating point and IfTrue & IfFalse are vectors, we will
@@ -3060,19 +3062,14 @@ static SDValue LowerVectorSELECT_CC(SDValue Op, SelectionDAG &DAG) {
3060
3062
3061
3063
SDValue VSetCC = DAG.getSetCC (dl, CVT, LHS, RHS, CC);
3062
3064
SDValue ResCC = LowerVectorSETCC (VSetCC, DAG);
3063
- EVT IfTrueVT = IfTrue.getValueType ();
3064
- EVT CastEltT =
3065
- MVT::getIntegerVT (IfTrueVT.getVectorElementType ().getSizeInBits ());
3066
- EVT CastVT = EVT::getVectorVT (*DAG.getContext (), CastEltT,
3067
- IfTrueVT.getVectorNumElements ());
3068
3065
if (CEltT.getSizeInBits () < IfTrueVT.getSizeInBits ()) {
3069
3066
EVT DUPVT =
3070
3067
EVT::getVectorVT (*DAG.getContext (), CEltT,
3071
3068
IfTrueVT.getSizeInBits () / CEltT.getSizeInBits ());
3072
3069
ResCC = DAG.getNode (AArch64ISD::NEON_VDUPLANE, dl, DUPVT, ResCC,
3073
3070
DAG.getConstant (0 , MVT::i64 , false ));
3074
3071
3075
- ResCC = DAG.getNode (ISD::BITCAST, dl, CastVT , ResCC);
3072
+ ResCC = DAG.getNode (ISD::BITCAST, dl, CondVT , ResCC);
3076
3073
} else {
3077
3074
// FIXME: If IfTrue & IfFalse hold v1i8, v1i16 or v1i32, this function
3078
3075
// can't handle them and will hit this assert.
@@ -3084,7 +3081,7 @@ static SDValue LowerVectorSELECT_CC(SDValue Op, SelectionDAG &DAG) {
3084
3081
EVT ExVT = EVT::getVectorVT (*DAG.getContext (), CEltT, ExEltNum);
3085
3082
ResCC = DAG.getNode (ISD::EXTRACT_SUBVECTOR, dl, ExVT, ResCC,
3086
3083
DAG.getConstant (0 , MVT::i64 , false ));
3087
- ResCC = DAG.getNode (ISD::BITCAST, dl, CastVT , ResCC);
3084
+ ResCC = DAG.getNode (ISD::BITCAST, dl, CondVT , ResCC);
3088
3085
}
3089
3086
SDValue VSelect = DAG.getNode (ISD::VSELECT, dl, IfTrue.getValueType (),
3090
3087
ResCC, IfTrue, IfFalse);
@@ -3113,11 +3110,9 @@ static SDValue LowerVectorSELECT_CC(SDValue Op, SelectionDAG &DAG) {
3113
3110
}
3114
3111
SDValue VDup;
3115
3112
if (IfTrue.getValueType ().getVectorNumElements () == 1 )
3116
- VDup = DAG.getNode (ISD::SCALAR_TO_VECTOR, dl, IfTrue.getValueType (),
3117
- A64SELECT_CC);
3113
+ VDup = DAG.getNode (ISD::SCALAR_TO_VECTOR, dl, CondVT, A64SELECT_CC);
3118
3114
else
3119
- VDup = DAG.getNode (AArch64ISD::NEON_VDUP, dl, IfTrue.getValueType (),
3120
- A64SELECT_CC);
3115
+ VDup = DAG.getNode (AArch64ISD::NEON_VDUP, dl, CondVT, A64SELECT_CC);
3121
3116
SDValue VSelect = DAG.getNode (ISD::VSELECT, dl, IfTrue.getValueType (),
3122
3117
VDup, IfTrue, IfFalse);
3123
3118
return VSelect;
0 commit comments