diff --git a/tools/cgeist/Lib/CGCall.cc b/tools/cgeist/Lib/CGCall.cc index c5e4d40ca2d9..bbabd848517f 100644 --- a/tools/cgeist/Lib/CGCall.cc +++ b/tools/cgeist/Lib/CGCall.cc @@ -541,6 +541,21 @@ MLIRScanner::EmitClangBuiltinCallExpr(clang::CallExpr *expr) { ValueCategory(builder.create(loc, 0, resultType), /*isRef*/ false)); } + case Builtin::BIsqrt: + case Builtin::BIsqrtf: + case Builtin::BIsqrtl: + case Builtin::BI__builtin_sqrt: + case Builtin::BI__builtin_sqrtf: + case Builtin::BI__builtin_sqrtf16: + case Builtin::BI__builtin_sqrtl: + case Builtin::BI__builtin_sqrtf128: + case Builtin::BI__builtin_elementwise_sqrt: { + auto v = Visit(expr->getArg(0)); + assert(!v.isReference); + Value res = builder.create(loc, v.val); + auto postTy = getMLIRType(expr->getType()); + return success(ValueCategory(res, /*isRef*/ false)); + } case Builtin::BI__builtin_clzs: case Builtin::BI__builtin_clz: case Builtin::BI__builtin_clzl: diff --git a/tools/cgeist/Lib/clang-mlir.cc b/tools/cgeist/Lib/clang-mlir.cc index a3f14408b2c4..36e8af8c7a6d 100644 --- a/tools/cgeist/Lib/clang-mlir.cc +++ b/tools/cgeist/Lib/clang-mlir.cc @@ -1824,18 +1824,6 @@ MLIRScanner::EmitBuiltinOps(clang::CallExpr *expr) { /*isReference*/ false), true); } - if (sr->getDecl()->getIdentifier() && - (sr->getDecl()->getName() == "sqrtf" || - sr->getDecl()->getName() == "sqrt")) { - std::vector args; - for (auto a : expr->arguments()) { - args.push_back(Visit(a).getValue(loc, builder)); - } - return make_pair( - ValueCategory(builder.create(loc, args[0]), - /*isReference*/ false), - true); - } if (sr->getDecl()->getIdentifier() && (sr->getDecl()->getName() == "expf" || sr->getDecl()->getName() == "exp")) {