@@ -201,40 +201,6 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
201
201
e->getSourceRange ().getBegin ());
202
202
}
203
203
204
- mlir::Value
205
- VisitAbstractConditionalOperator (const AbstractConditionalOperator *e) {
206
- mlir::Location loc = cgf.getLoc (e->getSourceRange ());
207
- Expr *condExpr = e->getCond ();
208
- Expr *lhsExpr = e->getTrueExpr ();
209
- Expr *rhsExpr = e->getFalseExpr ();
210
-
211
- QualType condType = condExpr->getType ();
212
-
213
- // OpenCL: If the condition is a vector, we can treat this condition like
214
- // the select function.
215
- if ((cgf.getLangOpts ().OpenCL && condType->isVectorType ()) ||
216
- condType->isExtVectorType ()) {
217
- cgf.cgm .errorNYI (loc, " TernaryOp OpenCL VectorType condition" );
218
- return {};
219
- }
220
-
221
- if (condType->isVectorType () || condType->isSveVLSBuiltinType ()) {
222
- if (!condExpr->getType ()->isVectorType ()) {
223
- cgf.cgm .errorNYI (loc, " TernaryOp for SVE vector" );
224
- return {};
225
- }
226
-
227
- mlir::Value condValue = Visit (condExpr);
228
- mlir::Value lhsValue = Visit (lhsExpr);
229
- mlir::Value rhsValue = Visit (rhsExpr);
230
- return builder.create <cir::VecTernaryOp>(loc, condValue, lhsValue,
231
- rhsValue);
232
- }
233
-
234
- cgf.cgm .errorNYI (loc, " TernaryOp for non vector types" );
235
- return {};
236
- }
237
-
238
204
mlir::Value VisitMemberExpr (MemberExpr *e);
239
205
240
206
mlir::Value VisitInitListExpr (InitListExpr *e);
@@ -1990,19 +1956,28 @@ mlir::Value ScalarExprEmitter::VisitAbstractConditionalOperator(
1990
1956
}
1991
1957
}
1992
1958
1959
+ QualType condType = condExpr->getType ();
1960
+
1993
1961
// OpenCL: If the condition is a vector, we can treat this condition like
1994
1962
// the select function.
1995
- if ((cgf.getLangOpts ().OpenCL && condExpr-> getType () ->isVectorType ()) ||
1996
- condExpr-> getType () ->isExtVectorType ()) {
1963
+ if ((cgf.getLangOpts ().OpenCL && condType ->isVectorType ()) ||
1964
+ condType ->isExtVectorType ()) {
1997
1965
assert (!cir::MissingFeatures::vectorType ());
1998
1966
cgf.cgm .errorNYI (e->getSourceRange (), " vector ternary op" );
1999
1967
}
2000
1968
2001
- if (condExpr->getType ()->isVectorType () ||
2002
- condExpr->getType ()->isSveVLSBuiltinType ()) {
2003
- assert (!cir::MissingFeatures::vecTernaryOp ());
2004
- cgf.cgm .errorNYI (e->getSourceRange (), " vector ternary op" );
2005
- return {};
1969
+ if (condType->isVectorType () || condType->isSveVLSBuiltinType ()) {
1970
+ if (!condType->isVectorType ()) {
1971
+ assert (!cir::MissingFeatures::vecTernaryOp ());
1972
+ cgf.cgm .errorNYI (loc, " TernaryOp for SVE vector" );
1973
+ return {};
1974
+ }
1975
+
1976
+ mlir::Value condValue = Visit (condExpr);
1977
+ mlir::Value lhsValue = Visit (lhsExpr);
1978
+ mlir::Value rhsValue = Visit (rhsExpr);
1979
+ return builder.create <cir::VecTernaryOp>(loc, condValue, lhsValue,
1980
+ rhsValue);
2006
1981
}
2007
1982
2008
1983
// If this is a really simple expression (like x ? 4 : 5), emit this as a
0 commit comments