================
@@ -1080,40 +1191,67 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl
&gd, unsigned builtinID,
convertType(e->getType())));
}
case Builtin::BI__builtin_nondeterministic_value:
- case Builtin::BI__builtin_elementwise_abs:
return errorBuiltinNYI(*this, e, builtinID);
+ case Builtin::BI__builtin_elementwise_abs: {
+ mlir::Type cirTy = convertType(e->getArg(0)->getType());
+ bool isIntTy = cir::isIntOrVectorOfIntType(cirTy);
+ if (!isIntTy)
+ return emitUnaryFPBuiltin<cir::FAbsOp>(*this, *e);
+ mlir::Value arg = emitScalarExpr(e->getArg(0));
+ mlir::Value result = cir::AbsOp::create(builder, getLoc(e->getExprLoc()),
+ arg.getType(), arg, false);
+ return RValue::get(result);
+ }
case Builtin::BI__builtin_elementwise_acos:
----------------
andykaylor wrote:
Can you remove the redundant handlers?
https://github.com/llvm/llvm-project/pull/175233
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits