@@ -201,40 +201,6 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
201201 e->getSourceRange ().getBegin ());
202202 }
203203
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-
238204 mlir::Value VisitMemberExpr (MemberExpr *e);
239205
240206 mlir::Value VisitInitListExpr (InitListExpr *e);
@@ -1990,19 +1956,28 @@ mlir::Value ScalarExprEmitter::VisitAbstractConditionalOperator(
19901956 }
19911957 }
19921958
1959+ QualType condType = condExpr->getType ();
1960+
19931961 // OpenCL: If the condition is a vector, we can treat this condition like
19941962 // 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 ()) {
19971965 assert (!cir::MissingFeatures::vectorType ());
19981966 cgf.cgm .errorNYI (e->getSourceRange (), " vector ternary op" );
19991967 }
20001968
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);
20061981 }
20071982
20081983 // If this is a really simple expression (like x ? 4 : 5), emit this as a
0 commit comments